Show Stopper 
July 23rd, 2005, 12:22 PM
| | | |
The contents of a simple form are sent to a Perl CGI in the server.
The Perl code is:
use CGI qw(:standard);
print "Content-type: text/html\n\n";
print "<html><head></head><body>Testing Thruput<br>";
print "<script language="JavaScript">";
print "</script>";
$value = param(myname);
print "$value<br>";
$value = param(addr);
print "$value<br>";
print "</body></html>";
If <script language="JavaScript"> and the matching </script> tag are
output to the browser, it will not process -- the browser hangs. If
these two lines are commented out, the browser handles the page
without a problem.
Question: Cannot a CGI output an HTML page that includes JavaScript?
I'm either missing something basic, or making a dumb mistake.
Pat | 
July 23rd, 2005, 12:22 PM
| | | | re: Show Stopper
On 3 Jun 2004 10:53:32 -0700, Pat wrote:
[color=blue]
> print "<script language="JavaScript">";[/color]
try..
print "<script type='text/javascript'>";
N.B. use of single quotes..
--
Andrew Thompson http://www.PhySci.org/ Open-source software suite http://www.PhySci.org/codes/ Web & IT Help http://www.1point1C.org/ Science & Technology | 
July 23rd, 2005, 12:22 PM
| | | | re: Show Stopper
You have a quoting problem.
Try:
print "<script language='JavaScript'>";
print "</script>";
or:
print "<script language=\"JavaScript\">";
print "</script>";
--
i.m.
The USA Patriot Act is the most unpatriotic act in American history. | 
July 23rd, 2005, 12:22 PM
| | | | re: Show Stopper
Pat wrote:
[color=blue]
> print "<script language="JavaScript">";[/color]
^
Quote marks!
And, since 1996, the language attribute has been deprecated and the type
attribute required.
print qq(<script type="text/javascript">);
or
print "<script type=\"text/javascript\">";
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is | 
July 23rd, 2005, 12:22 PM
| | | | re: Show Stopper
Pat said:[color=blue]
>
>Question: Cannot a CGI output an HTML page that includes JavaScript?[/color]
For future reference, that would have made a much better
subject line than "Show Stopper". | 
July 23rd, 2005, 12:23 PM
| | | | re: Show Stopper
Ivan Marsh wrote:
[color=blue]
> You have a quoting problem.
>
> Try:
>
> print "<script language='JavaScript'>";
> print "</script>";
>
> or:
>
> print "<script language=\"JavaScript\">";
>
>
>[/color]
Or
print "<\/script>";
Mick | 
July 23rd, 2005, 12:23 PM
| | | | re: Show Stopper
Mick White said:[color=blue]
>
>Ivan Marsh wrote:
>[color=green]
>> You have a quoting problem.
>>
>> Try:
>>
>> print "<script language='JavaScript'>";
>> print "</script>";
>>
>> or:
>>
>> print "<script language=\"JavaScript\">";
>>
>>
>>[/color]
>Or
>print "<\/script>";[/color]
No need for that, since Perl doesn't find anything magical about "</".
That's only necessary if the code that's doing the writing is within
an XHTML page. | 
July 23rd, 2005, 12:23 PM
| | | | re: Show Stopper
Lee <REM0VElbspamtrap@cox.net> wrote in message news:<c9nq9a024n@drn.newsguy.com>...[color=blue]
> Pat said:[color=green]
> >
> >Question: Cannot a CGI output an HTML page that includes JavaScript?[/color]
>
> For future reference, that would have made a much better
> subject line than "Show Stopper".[/color]
Thanks to all of you for pointing out this basic error on my part. I
discovered it after I'd posted the message, and feel like a beginner
(which I am)!
And roger on a better subject line for my original message. I'll have
to think more about the subject, and not my feelings of the moment.
Thanks, all
Pat | 
July 23rd, 2005, 12:23 PM
| | | | re: Show Stopper
"Pat" <pmcclure33@yahoo.com> wrote in message
news:fdda218c.0406031620.20327f60@posting.google.c om...[color=blue]
> Lee <REM0VElbspamtrap@cox.net> wrote in message[/color]
news:<c9nq9a024n@drn.newsguy.com>...[color=blue][color=green]
> > Pat said:[color=darkred]
> > >
> > >Question: Cannot a CGI output an HTML page that includes JavaScript?[/color]
> >
> > For future reference, that would have made a much better
> > subject line than "Show Stopper".[/color]
>
>
> Thanks to all of you for pointing out this basic error on my part. I
> discovered it after I'd posted the message, and feel like a beginner
> (which I am)!
>
> And roger on a better subject line for my original message. I'll have
> to think more about the subject, and not my feelings of the moment.
>[/color]
I just thought that this concept should not be buried in a thread, so I made
it the subject line. Not only newbies, either!
--
Mabden |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,689 network members.
|