in reply to Re: Equivalent functionality in CGI.pm
in thread Equivalent functionality in CGI.pm
I agree. And I'm not saying you should do otherwise but I end up putting JS into CGIs now and then anyway (throwaways, portability, timeframe, etc).
One way to do it when you feel the need to is with HERE docs. You can inline them too.
print start_html( -title => $title, -script => <<HEREisAscript, <!-- function focus_first_field(){document.forms[0].elements[0].focus();} // --> HEREisAscript -onload => 'focus_first_field()', ), <<HERESanother, <script type="text/javascript"> <!-- function toggleEmail(evt) { // longer script omitted... } // --> </script> HERESanother 'Show Email:', radio_group(-id => 'hideEmail', -name => 'radioEmail', -values => [ qw(Yes No) ], -default => 'No', -onclick => 'toggleEmail(event)' );
There is more information about using JS this way in the CGI perldoc itself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Equivalent functionality in CGI.pm
by MSchienle (Novice) on Jul 04, 2004 at 20:08 UTC | |
by Your Mother (Archbishop) on Jul 04, 2004 at 20:42 UTC | |
by MSchienle (Novice) on Jul 04, 2004 at 21:06 UTC |