File: pjx_checkbox.pl

package info (click to toggle)
libcgi-ajax-perl 0.707-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,669; makefile: 2
file content (40 lines) | stat: -rwxr-xr-x 677 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl -w
use strict;
use CGI::Ajax;
use CGI;


my $perl_func = sub {
  my $input = shift;

  print "got $input";
}; 

sub Show_HTML {
  my $html = "";
  $html .= <<EOT;

<html>
<head><title>CGI::Ajax Example</title>
</head>
<body>
<form>
  <input type="checkbox" name="val1" id="val1" value="44" size="6" /> val1<br/>
  <input type='submit' onmouseover=jsFunc(['val1'],['out']); />
     
  <div id="out"> </div>
</body>
</html>
EOT

  return $html;
}

my $cgi = new CGI();  # create a new CGI object

my $pjx = new CGI::Ajax( 'jsFunc' => $perl_func );
$pjx->JSDEBUG(1);
$pjx->DEBUG(1);

print $pjx->build_html($cgi,\&Show_HTML); # this outputs the html for the page