annotate scripts/pjx_checkbox.pl @ 10:3b52ac950753 boosterpack tip

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