[Javascript] Wacky unterminated string + alert + IFRAME error....

TomMallard mallard at serv.net
Mon May 7 16:24:07 CDT 2001


ilSrc = 'javascript:document.write('+qt+'<script>
language="JavaScript">alert("works!");</script>'+qt+');';

Isn't there an extra > in the script tag?

<script> language="JavaScript">

...that's probably it...if that's not it, my first reaction was that you
need eval to write the line...

ilSrc = eval('javascript:document.write('+qt+'<script
language="JavaScript">alert("works!");</script>'+qt+');

tom
----- Original Message -----
From: "Craig Michael Nathan" <cnathan at MEconomy.com>
To: <mallard at serv.net>
Cc: <javascript at LaTech.edu>
Sent: Monday, May 07, 2001 1:39 PM
Subject: Re: [Javascript] Wacky unterminated string + alert + IFRAME
error....


> If I comment out the "// alert ('isIE!');"
> line, then I get the error on the next line
> (which is all on one line in the script, but E-Mail wraps....):
>
> ilSrc = 'javascript:document.write('+qt+'<script>
> language="JavaScript">alert("works!");</script>'+qt+');';
>
> What's interesting is that if I remove the "/" from
> the "</script>", it doesn't complain (but also doesn't
> throw up the "works!" alert).
>
> Thanks!
>
> -Craig
>
>
>
> >From: "TomMallard" <mallard at serv.net>
> >To: <javascript at LaTech.edu>
> >Subject: Re: [Javascript] Wacky unterminated string + alert + IFRAME
error....
> >Date: Mon, 7 May 2001 06:59:43 -0700
> >Organization: Individual
> >Reply-To: javascript at LaTech.edu
> >
> >What line does the error message have without the alert in it?
> >
> >tom
> >----- Original Message -----
> >From: "Craig Michael Nathan" <cnathan at MEconomy.com>
> >To: <javascript at LaTech.edu>
> >Sent: Monday, May 07, 2001 12:50 AM
> >
> >
> >
> >From: "TomMallard" <mallard at serv.net>
> >To: <javascript at LaTech.edu>
> >Subject: Re: [Javascript] Wacky unterminated string + alert + IFRAME
error....
> >Date: Mon, 7 May 2001 06:59:43 -0700
> >Organization: Individual
> >Reply-To: javascript at LaTech.edu
> >
> >What line does the error message have without the alert in it?
> >
> >tom
> >
> >> 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