Show Stopper

P

Pat

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
 
I

Ivan Marsh

You have a quoting problem.

Try:

print "<script language='JavaScript'>";
print "</script>";

or:

print "<script language=\"JavaScript\">";
print "</script>";
 
L

Lee

Pat said:
Question: Cannot a CGI output an HTML page that includes JavaScript?

For future reference, that would have made a much better
subject line than "Show Stopper".
 
D

David Dorward

Pat said:
print "<script language="JavaScript">";
^
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\">";
 
M

Mick White

Ivan said:
You have a quoting problem.

Try:

print "<script language='JavaScript'>";
print "</script>";

or:

print "<script language=\"JavaScript\">";
Or
print "<\/script>";
Mick
 
L

Lee

Mick White said:
Or
print "<\/script>";

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

Pat

Lee said:
Pat said:

For future reference, that would have made a much better
subject line than "Show Stopper".


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top