I want to be able to embed a single quote into an INPUT element
within a dynamically generated IFRAME. The example below
shows how the IFRAME is generated.
Challenge: I'd like the alert box to show: Mom said, "Don't"
instead of the current: Mom said, "Do not".
The point of the exercise is that I will be passing arbitrary
strings to the IFRAME and I want to ensure that the final
string is the same as the original. So I'm interested in dealing
with all the troublemaker characters.
Thanks,
Csaba Gabor from New York
PS. The point of the alert is to validate that everything
is copasetic with the IFRAME.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TI TLE>IFrame test page</TITLE>
<META http-equiv=Content-Type
content="text/html; charset=windows-1252">
<SCRIPT type="text/javascript">
function makeIframe() {
var iframe = document.create Element("IFRAME ");
iframe.src = "javascript:'<H TML><HEAD>";
iframe.src += "<TITLE>Dyn amic IFrame</TITLE>";
iframe.src += '</HEAD><BODY onLoad="alert(' ;
iframe.src += 'document.getEl ementById(';
iframe.src += '"myInput& quot;).value)"> ';
iframe.src += '<FORM method=get action=dummy.ph p>';
iframe.src += "<input type=text id=" + "myInput ";
iframe.src += 'value="Mom said, "Do not"">';
iframe.src += "</FORM></BODY></HTML>'"
document.body.a ppendChild(ifra me);
}
</SCRIPT>
</HEAD><BODY style="margin:5 %" onLoad="makeIfr ame()">
Main Body
</BODY>
</HTML>
within a dynamically generated IFRAME. The example below
shows how the IFRAME is generated.
Challenge: I'd like the alert box to show: Mom said, "Don't"
instead of the current: Mom said, "Do not".
The point of the exercise is that I will be passing arbitrary
strings to the IFRAME and I want to ensure that the final
string is the same as the original. So I'm interested in dealing
with all the troublemaker characters.
Thanks,
Csaba Gabor from New York
PS. The point of the alert is to validate that everything
is copasetic with the IFRAME.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TI TLE>IFrame test page</TITLE>
<META http-equiv=Content-Type
content="text/html; charset=windows-1252">
<SCRIPT type="text/javascript">
function makeIframe() {
var iframe = document.create Element("IFRAME ");
iframe.src = "javascript:'<H TML><HEAD>";
iframe.src += "<TITLE>Dyn amic IFrame</TITLE>";
iframe.src += '</HEAD><BODY onLoad="alert(' ;
iframe.src += 'document.getEl ementById(';
iframe.src += '"myInput& quot;).value)"> ';
iframe.src += '<FORM method=get action=dummy.ph p>';
iframe.src += "<input type=text id=" + "myInput ";
iframe.src += 'value="Mom said, "Do not"">';
iframe.src += "</FORM></BODY></HTML>'"
document.body.a ppendChild(ifra me);
}
</SCRIPT>
</HEAD><BODY style="margin:5 %" onLoad="makeIfr ame()">
Main Body
</BODY>
</HTML>
Comment