Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Perl not running Javascript

by Anonymous Monk
on Nov 07, 2007 at 07:15 UTC ( [id://649415]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Perl not running Javascript
by duff (Parson) on Nov 07, 2007 at 07:22 UTC

    Your question really has nothing to do with Perl at all. However, I did notice that the script tag you are outputting is incorrect, so the browser is never even loading your javascript file to begin with.

Re: Perl not running Javascript
by moritz (Cardinal) on Nov 07, 2007 at 09:10 UTC
    Others have pointed out that the problem was invalid HTML.

    To detect such glitches, you can always validate your HTML output.

    Another possibility is to produce xhtml and send a proper header, so that browsers display the page in "standards compliance mode" and complains about invalid xhtml. At least Firefox does.

Re: Perl not running Javascript
by scorpio17 (Canon) on Nov 07, 2007 at 14:48 UTC

    1) Javascript stuff should not go into the cgi-bin directory. It should either be in the html directory, or a subdirectory under html. In other words, if you have an html file containing a line like src="script.js", script.js needs to be in the same directory as the html (just like image files in IMG src tags).

    2) Java and javascript are two totally different things - it is unfortunate that they have similar names. Installing java will not help your javascript in any way, shape, or form.

    3) Javascript is an interpreted language, but the interpreter is not on your server - it's built into the client-side browser. Since different browsers have slightly different implementations, it can be difficult to write javascript that does the same thing on multiple platforms.

Re: Perl not running Javascript
by Gangabass (Vicar) on Nov 07, 2007 at 08:19 UTC

    Try this:

    print qq{<script type="text/javascript" src="ncbi.js"></script>};
      Hello,

      I changed this line in the header as you suggested but it still not working. THe code I got this from is at:
      http://nsaunders.wordpress.com/2007/02/20/my-first-ajax-for-bioinformatics-page/
      I have only modified the last script from PHP to PERL and changed the location where the script is called. Any help would be appreciated.

      Thanks.

        If you have JS-file in your cgi-bin directory (but it's a bad idea as others pointed) the line should be:

        print qq{<script type="text/javascript" src="/cgi-bin/ncbi.js"></scrip +t>};

        Also take a look at CGI.pm it's make life easy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://649415]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found