diff BoosterPack/scripts/pjx_change_encoding.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_change_encoding.pl	Mon Sep 27 16:57:26 2010 -0400
     1.3 @@ -0,0 +1,44 @@
     1.4 +#!C:/strawberry/perl/bin/perl.exe
     1.5 +
     1.6 +use strict;
     1.7 +use CGI::Ajax;
     1.8 +use CGI;
     1.9 +
    1.10 +my $func = sub {
    1.11 +  my $input = shift;
    1.12 +  return "got input: $input " ;
    1.13 +};
    1.14 +
    1.15 +
    1.16 +sub Show_HTML {
    1.17 +my  $html = <<EOT;
    1.18 +
    1.19 +<html>
    1.20 +<head><title>CGI::Ajax Example</title>
    1.21 +
    1.22 +</head>
    1.23 +<body>
    1.24 +<form>
    1.25 +Enter Something:&nbsp;
    1.26 +  <input type="text" name="val1" id="val1" size="6" onkeyup="jsfunc( ['val1'], 'result' ); return true;"><br>
    1.27 +Enter Something:&nbsp;
    1.28 +    <hr>
    1.29 +    <div id="result" style="border: 1px solid black;
    1.30 +          width: 440px; height: 80px; overflow: auto">
    1.31 +    </div>
    1.32 +
    1.33 +</form>
    1.34 +</body>
    1.35 +</html>
    1.36 +
    1.37 +EOT
    1.38 +
    1.39 +}
    1.40 +
    1.41 +my $cgi = new CGI();  # create a new CGI object
    1.42 +my $pjx = new CGI::Ajax( 'jsfunc' => $func );
    1.43 +# the default encoding for CGI::Ajax is encodeURIComponent;
    1.44 +# if this causes problems, you can use escape or your own javascript
    1.45 +# function;
    1.46 +$pjx->js_encode_function('escape');
    1.47 +print $pjx->build_html($cgi,\&Show_HTML);