Connecting Tech Pros Worldwide Help | Site Map

Show Stopper

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 11:22 AM
Pat
Guest
 
Posts: n/a
Default Show Stopper

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

  #2  
Old July 23rd, 2005, 11:22 AM
Andrew Thompson
Guest
 
Posts: n/a
Default 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
  #3  
Old July 23rd, 2005, 11:22 AM
Ivan Marsh
Guest
 
Posts: n/a
Default 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.

  #4  
Old July 23rd, 2005, 11:22 AM
David Dorward
Guest
 
Posts: n/a
Default 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
  #5  
Old July 23rd, 2005, 11:22 AM
Lee
Guest
 
Posts: n/a
Default 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".

  #6  
Old July 23rd, 2005, 11:23 AM
Mick White
Guest
 
Posts: n/a
Default 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
  #7  
Old July 23rd, 2005, 11:23 AM
Lee
Guest
 
Posts: n/a
Default 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.

  #8  
Old July 23rd, 2005, 11:23 AM
Pat
Guest
 
Posts: n/a
Default 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
  #9  
Old July 23rd, 2005, 11:23 AM
Mabden
Guest
 
Posts: n/a
Default [OT] I'll have to think more about the subject, and not my feelings of the moment

"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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

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 220,989 network members.