[Pdx-pm] CGI.pm question about start_html(-script)

publiustemp-pdxpm at yahoo.com publiustemp-pdxpm at yahoo.com
Mon Jul 19 15:00:16 CDT 2004


--- Thomas J Keller <kellert at ohsu.edu> wrote:
> Greetings CGI.pm users,
> I would like to call more than one external javascript script in a 
> workrequest form I'm writing using CGI.pm. How do I code that in the 
> start_html() method?
[snip]
> And I've tried giving -script an anonymous array:
> 	-script=>[	{'-language'=>'JavaScript',
> 			'-src'=>'http://www.ohsu.edu/include/header_alt.js',
> 			}, {'-language'=>'JavaScript',
> 			'-src'=>'http://www.ohsu.edu/research/core/verify.js',
> 			}, {'-language'=>'JavaScript',
> 			'-src'=>'http://www.ohsu.edu/research/core/verify2.js',
> 			} ]

Hi Tom,

Maybe I'm missing something obvious, but I don't see the problem.  This:

  print $q->start_html(
    -title=>'The Riddle of the Sphinx',
    -script=>[
      { 
        -language => 'JavaScript',
        -src      => '/javascript/utilities10.js'
      },
      { 
        -language => 'JavaScript',
        -src      => '/javascript/utilities11.js'
      },
    ]
  );

Prints this:

  <?xml version="1.0" encoding="utf-8"?>
  <!DOCTYPE html
          PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
          "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head><title>The Riddle of the
Sphinx</title>
  <script language="JavaScript" src="/javascript/utilities10.js" type="text/javascript"></script>
  <script language="JavaScript" src="/javascript/utilities11.js" type="text/javascript"></script>
  </head><body>

Can you provide us with a larger code snippet?  What version of CGI.pm are you using?  Also, when
you say it doesn't work, what output are you expecting and what output are you actually getting?

Cheers,
Ovid

=====
Silence is Evil            http://users.easystreet.com/ovid/philosophy/indexdecency.htm
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/



More information about the Pdx-pm-list mailing list