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

TomMallard mallard at serv.net
Mon May 7 16:55:29 CDT 2001


So what you're trying to do is dynamically write the alert box...hmmmm

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

I'll have to play with this later...is this fired with onclick? You tried
eval(ilSrc);?

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


> In this latest rev, yes -- I accidentally left a ">"
> from the quoted response.  The actual line is (with
> e-mail added line breaks):
>
> ilSrc = 'javascript:document.write('+qt+'<script
> language="JavaScript">alert("works!");</script>'+qt+');';
>
>
> I tried the eval() trick, to no avail.  I also tried
> escaping the "/", as well as replacing it with a
> variable (var sl = '/';), but neither helped.
>
>
> Any thoughts on why this happens when I don't have the
> alert('isIE'); call, but doesn't when that call is
> commented out?
>
>
> Thanks!
>
> -Craig
>
>
> TomMallard wrote:
> >
> > 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();
> > >
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list