こんな感じでできる、へぇ〜。
Netscape 3.0 and higher allows you to place the JavaScript code
in an external
document and refer to it by URL. This allows you to keep the JavaScript
code in a file or CGI script rather than cluttering up each page with the
source. Netscape 3.X-4.X and Internet Explorer 3.X-4.X also recognize a “language”
parameter that allows you to use other languages, such as VBScript and
PerlScript (yes indeed!) To use these attributes pass a HASH
reference in the -script parameter containing one
or more of the keys language, src, or
code. Here’s how to refer to an external script URL:print $q->start_html(-title=>'The Riddle of the Sphinx', -script=>{-language=>'JavaScript', -src=>'/javascript/sphinx.js'} );Here’s how to refer to scripting code incorporated directly into the page:
print $q->start_html(-title=>'The Riddle of the Sphinx', -script=>{-language=>'PerlScript', -code=>'print "hello world!\n;"'} );A final feature allows you to incorporate multiple <SCRIPT> sections into the
header. Just pass the list of script sections as an array reference.
This allows you to specify different source files for different dialects
of JavaScript. Example:print $q->start_html(-title=>'The Riddle of the Sphinx', -script=>[ { -language => 'JavaScript1.0', -src => '/javascript/utilities10.js' }, { -language => 'JavaScript1.1', -src => '/javascript/utilities11.js' }, { -language => 'JavaScript1.2', -src => '/javascript/utilities12.js' }, { -language => 'JavaScript28.2', -src => '/javascript/utilities219.js' } ] );(If this looks a bit extreme, take my advice and stick with straight CGI scripting.)