annotate BoosterPack/scripts/pjx_checkbox.pl @ 0:0d795f02a8bb tip

initial committ. what was I thinking?
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 16:57:26 -0400
parents
children
rev   line source
rlm@0 1 #!C:/strawberry/perl/bin/perl.exe
rlm@0 2 use strict;
rlm@0 3 use CGI::Ajax;
rlm@0 4 use CGI;
rlm@0 5
rlm@0 6
rlm@0 7 my $perl_func = sub {
rlm@0 8 my $input = shift;
rlm@0 9
rlm@0 10 print "got $input";
rlm@0 11 };
rlm@0 12
rlm@0 13 sub Show_HTML {
rlm@0 14 my $html = "";
rlm@0 15 $html .= <<EOT;
rlm@0 16
rlm@0 17 <html>
rlm@0 18 <head><title>CGI::Ajax Example</title>
rlm@0 19 </head>
rlm@0 20 <body>
rlm@0 21 <form>
rlm@0 22 <input type="checkbox" name="val1" id="val1" value="44" size="6" /> val1<br/>
rlm@0 23 <input type='submit' onmouseover=jsFunc(['val1'],['out']); />
rlm@0 24
rlm@0 25 <div id="out"> </div>
rlm@0 26 </body>
rlm@0 27 </html>
rlm@0 28 EOT
rlm@0 29
rlm@0 30 return $html;
rlm@0 31 }
rlm@0 32
rlm@0 33 my $cgi = new CGI(); # create a new CGI object
rlm@0 34
rlm@0 35 my $pjx = new CGI::Ajax( 'jsFunc' => $perl_func );
rlm@0 36 $pjx->JSDEBUG(1);
rlm@0 37 $pjx->DEBUG(1);
rlm@0 38
rlm@0 39 print $pjx->build_html($cgi,\&Show_HTML); # this outputs the html for the page
rlm@0 40