Show Stopper

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pat

    #1

    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><hea d></head><body>Test ing Thruput<br>";

    print "<script language="JavaS cript">";
    print "</script>";

    $value = param(myname);
    print "$value<br> ";
    $value = param(addr);
    print "$value<br> ";
    print "</body></html>";

    If <script language="JavaS cript"> 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

    #2
    Re: Show Stopper

    On 3 Jun 2004 10:53:32 -0700, Pat wrote:
    [color=blue]
    > print "<script language="JavaS cript">";[/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

    Comment

    • Ivan Marsh

      #3
      Re: Show Stopper

      You have a quoting problem.

      Try:

      print "<script language='JavaS cript'>";
      print "</script>";

      or:

      print "<script language=\"Java Script\">";
      print "</script>";


      --
      i.m.
      The USA Patriot Act is the most unpatriotic act in American history.

      Comment

      • David Dorward

        #4
        Re: Show Stopper

        Pat wrote:
        [color=blue]
        > print "<script language="JavaS cript">";[/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

        Comment

        • Lee

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

          Comment

          • Mick White

            #6
            Re: Show Stopper

            Ivan Marsh wrote:
            [color=blue]
            > You have a quoting problem.
            >
            > Try:
            >
            > print "<script language='JavaS cript'>";
            > print "</script>";
            >
            > or:
            >
            > print "<script language=\"Java Script\">";
            >
            >
            >[/color]
            Or
            print "<\/script>";
            Mick

            Comment

            • Lee

              #7
              Re: Show Stopper

              Mick White said:[color=blue]
              >
              >Ivan Marsh wrote:
              >[color=green]
              >> You have a quoting problem.
              >>
              >> Try:
              >>
              >> print "<script language='JavaS cript'>";
              >> print "</script>";
              >>
              >> or:
              >>
              >> print "<script language=\"Java Script\">";
              >>
              >>
              >>[/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.

              Comment

              • Pat

                #8
                Re: Show Stopper

                Lee <REM0VElbspamtr ap@cox.net> wrote in message news:<c9nq9a024 n@drn.newsguy.c om>...[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

                Comment

                • Mabden

                  #9
                  [OT] I'll have to think more about the subject, and not my feelings of the moment

                  "Pat" <pmcclure33@yah oo.com> wrote in message
                  news:fdda218c.0 406031620.20327 f60@posting.goo gle.com...[color=blue]
                  > Lee <REM0VElbspamtr ap@cox.net> wrote in message[/color]
                  news:<c9nq9a024 n@drn.newsguy.c om>...[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


                  Comment

                  Working...