Connecting Tech Pros Worldwide Forums | Help | Site Map

Show Stopper

Pat
Guest
 
Posts: n/a
#1: Jul 23 '05
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

Andrew Thompson
Guest
 
Posts: n/a
#2: Jul 23 '05

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
Ivan Marsh
Guest
 
Posts: n/a
#3: Jul 23 '05

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.

David Dorward
Guest
 
Posts: n/a
#4: Jul 23 '05

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
Lee
Guest
 
Posts: n/a
#5: Jul 23 '05

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".

Mick White
Guest
 
Posts: n/a
#6: Jul 23 '05

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
Lee
Guest
 
Posts: n/a
#7: Jul 23 '05

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.

Pat
Guest
 
Posts: n/a
#8: Jul 23 '05

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
Mabden
Guest
 
Posts: n/a
#9: Jul 23 '05

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


Closed Thread