Re: Needing some help here ;)

by "Ryan Fischer" <ryan(at)gigabee.com>

 Date:  Mon, 7 Jan 2002 12:54:58 -0500
 To:  "Nicholson,
Dale" <DNicholson(at)APACMail.com>,
<hwg-languages(at)hwg.org>
 References:  apacteleservices
  todo: View Thread, Original
Umm... no.

When the JavaScript is sent to the browser, it will have nested double
quotes which won't work.

Try it for yourself:

document.write("Good Morning, <cpanel print="DOMAIN">");

The above will throw a JavaScript error.

But change it to this:

document.write("Good Morning, <cpanel print=\"DOMAIN\">");

And no error will occur.

--
 -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/
----- Original Message -----
From: "Nicholson, Dale" <DNicholson(at)APACMail.com>
To: "'Ryan Fischer'" <ryan(at)gigabee.com>; <hwg-languages(at)hwg.org>
Sent: Monday, January 07, 2002 12:23 PM
Subject: RE: Needing some help here ;)


> If you were just using print without the qq your statement would be
correct.
> However, qq~ tells perl to read everything as plain text until the
next
> occurrence of ~.  Essentially, you tell Perl to use ~ instead of " for
this
> statement.
>
> The example I provided would treat the quotes as plain text and print
it
> out.  Having multiple quotes inside the print statement is irrelevant.
>
> Below is a larger working example from a Perl CGI program that writes
HTML:
>  print qq~
> <FORM NAME="search" ACTION="http://myurl/my.cgi" METHOD="POST">
> <BR>
> <FONT="arial">
> <p class="p">Search the text of all documents for a given string
(exact, non
> case sensitive match - leave blank to see all documents):<br>
> <INPUT TYPE='text' NAME="keywords" SIZE=40></p>
> <INPUT TYPE="submit" NAME="search" VALUE="Search all text"> <INPUT
> TYPE="reset
> " NAME="Reset"></form>
> <hr noshade width="90%">
> ~;
>
> As you can see, there are multiple quotes throughout the code.  The
actual
> code sent to the web browser is below, note that it is exactly like
what was
> between the tildes (~):
> <FORM NAME="search" ACTION="http://myurl/my.cgi" METHOD="POST">
> <BR>
> <FONT="arial">
> <p class="p">Search the text of all documents for a given string
(exact, non
> case sensitive match - leave blank to see all documents):<br>
> <INPUT TYPE='text' NAME="keywords" SIZE=40></p>
> <INPUT TYPE="submit" NAME="search" VALUE="Search all text"> <INPUT
> TYPE="reset" NAME="Reset"></form>
>
> Dale Nicholson
>
> > -----Original Message-----
> > From: Ryan Fischer [mailto:ryan(at)gigabee.com]
> > Sent: Monday, January 07, 2002 10:20 AM
> > To: hwg-languages(at)hwg.org
> > Subject: Re: Needing some help here ;)
> >
> >
> > You wrote:
> > > If you are trying to write the javascript with a Perl
> > script, you can
> > use
> > > something like this:
> > >
> > > print qq~
> > >    document.write("Good Morning, <cpanel print="DOMAIN">")
> > >
> > >    more html and javascript here....
> > > ~;
> >
> > The problem here is really that you're using double quotes
> > inside double
> > quotes.  You need to escape the inner quotes, or it's just not gonna
> > work.  Try this:
> >
> > document.write("Good Morning, <cpanel print=\"DOMAIN\">");
> >
> > HTH!  :)
> >
> > --
> >  -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/
> >
> >
>
>

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA