[Javascript] Wacky unterminated string + alert + IFRAME error....
Craig Michael Nathan
cnathan at MEconomy.com
Mon May 7 02:50:33 CDT 2001
Wacky unterminated string + alert + IFRAME error....
I have a page that embeds a remote javascript file.
That remote javascript file (MEchecker_test.js) creates
an IFRAME, and then attempts to write into it.
When the remote javascript file includes an alert() function,
it works perfectly. When I remove the alert() function,
I get an "unterminated string constant".
I've tested in both IE 5.01 and 5.5, with the same results.
Any ideas?
Please respond to: cnathan at MEconomy.com
Thanks!
-Craig
*************** HTML *********************
<html><head><title>Test</title><body>
<script language="JavaScript1.2" src="MEchecker_test.js"></script>
<h3>test</h3></body></html>
********* Remote JavaScript (MEchecker_test.js) ***********
document.write('<IFRAME ID="myIFRAME" WIDTH="0" HEIGHT="0"></IFRAME>');
var qt = "'";
function fillIFRAME() {
// *** UNCOMMENT THIS NEXT LINE TO MAKE THIS SCRIPT WORK:
// alert ('isIE!');
ilSrc = 'javascript:document.write('+qt+'<script
language="JavaScript">alert("works!");</script>'+qt+');';
document.all.myIFRAME.src = ilSrc;
}
window.onLoad=fillIFRAME();
More information about the Javascript
mailing list