Re: Needing some help here ;)
by "Richard Walker" <richardwalker(at)onebox.com>
|
Date: |
Tue, 8 Jan 2002 17:08:36 -0500 |
To: |
<hwg-languages(at)hwg.org> |
References: |
apacteleservices ryan |
|
todo: View
Thread,
Original
|
|
----- Original Message -----
From: "Ryan Fischer" <ryan(at)gigabee.com>
To: "Nicholson, Dale" <DNicholson(at)APACMail.com>;
<hwg-languages(at)hwg.org>
Sent: Monday, January 07, 2002 12:54 PM
Subject: Re: Needing some help here ;)
> 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.
That's why I really like HWG-Languages!!! We'll come up with so
many solutions.
Here, another variation:
print qq~
document.write('Good Morning, <cpanel print="DOMAIN">')
more html and javascript here....
~;
or:
print <<EOF;
<script language="javascript">
<!--
document.write ('Good Morning, <cpanel print ="DOMAIN">');
// this works
// so does this
// etc
// etc
// -->
</script>
EOF
>
> --
> -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