Mercurial > rlmcintyre
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/BoosterPack/scripts/pjx_checkbox.pl Mon Sep 27 16:57:26 2010 -0400 1.3 @@ -0,0 +1,40 @@ 1.4 +#!C:/strawberry/perl/bin/perl.exe 1.5 +use strict; 1.6 +use CGI::Ajax; 1.7 +use CGI; 1.8 + 1.9 + 1.10 +my $perl_func = sub { 1.11 + my $input = shift; 1.12 + 1.13 + print "got $input"; 1.14 +}; 1.15 + 1.16 +sub Show_HTML { 1.17 + my $html = ""; 1.18 + $html .= <<EOT; 1.19 + 1.20 +<html> 1.21 +<head><title>CGI::Ajax Example</title> 1.22 +</head> 1.23 +<body> 1.24 +<form> 1.25 + <input type="checkbox" name="val1" id="val1" value="44" size="6" /> val1<br/> 1.26 + <input type='submit' onmouseover=jsFunc(['val1'],['out']); /> 1.27 + 1.28 + <div id="out"> </div> 1.29 +</body> 1.30 +</html> 1.31 +EOT 1.32 + 1.33 + return $html; 1.34 +} 1.35 + 1.36 +my $cgi = new CGI(); # create a new CGI object 1.37 + 1.38 +my $pjx = new CGI::Ajax( 'jsFunc' => $perl_func ); 1.39 +$pjx->JSDEBUG(1); 1.40 +$pjx->DEBUG(1); 1.41 + 1.42 +print $pjx->build_html($cgi,\&Show_HTML); # this outputs the html for the page 1.43 +