Mercurial > rlmcintyre
comparison BoosterPack/scripts/.svn/text-base/pjx_change_encoding.pl.svn-base @ 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0d795f02a8bb |
---|---|
1 #!C:/strawberry/perl/bin/perl.exe | |
2 | |
3 use strict; | |
4 use CGI::Ajax; | |
5 use CGI; | |
6 | |
7 my $func = sub { | |
8 my $input = shift; | |
9 return "got input: $input " ; | |
10 }; | |
11 | |
12 | |
13 sub Show_HTML { | |
14 my $html = <<EOT; | |
15 | |
16 <html> | |
17 <head><title>CGI::Ajax Example</title> | |
18 | |
19 </head> | |
20 <body> | |
21 <form> | |
22 Enter Something: | |
23 <input type="text" name="val1" id="val1" size="6" onkeyup="jsfunc( ['val1'], 'result' ); return true;"><br> | |
24 Enter Something: | |
25 <hr> | |
26 <div id="result" style="border: 1px solid black; | |
27 width: 440px; height: 80px; overflow: auto"> | |
28 </div> | |
29 | |
30 </form> | |
31 </body> | |
32 </html> | |
33 | |
34 EOT | |
35 | |
36 } | |
37 | |
38 my $cgi = new CGI(); # create a new CGI object | |
39 my $pjx = new CGI::Ajax( 'jsfunc' => $func ); | |
40 # the default encoding for CGI::Ajax is encodeURIComponent; | |
41 # if this causes problems, you can use escape or your own javascript | |
42 # function; | |
43 $pjx->js_encode_function('escape'); | |
44 print $pjx->build_html($cgi,\&Show_HTML); |