There is no such thing as a cgi page. Doh- you say.
The clarity of this concept is vital.
You have to separate the idea of the client and what it/they experiences (the audience computer/visitors) and what your application (cgi/server) is doing.
Part of the Javascript idea is that you potentially let the end user's machine do some of the work, flip little pictures, throw javascript alerts.. draw little smily faces all over some dom node.
Think of your cgi's output as if you had written it yourself by hand.
So, restate your question. The right question is- Is there a simple way to execute a javascript function within a html(xhtml/rss/flash/anything downloaded from your server) page?
This has nothing to do with perl, and everything to do with html/javascript, google for body onload/etc if you want this to happen automatically without user interaction.
That said, CGI has some shortcuts to the html you spit out, and some minor javascript support.
That said, my advice is- if you are coding server side, forget javascript. Serve static content in the most boring manner possible. If you use actual content in your website, users will come.
Let the web designers and worry about javascript.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.