annotate scripts/pjx_url.pl @ 0:477258d09353 boosterpack

[svn r1] initial import
author robert
date Sun, 30 Aug 2009 02:19:26 -0400
parents
children
rev   line source
robert@0 1 #!C:/strawberry/perl/bin/perl.exe
robert@0 2
robert@0 3 # this is an example script of how you would use URLs to define
robert@0 4 # your CGI::Ajax functions.
robert@0 5
robert@0 6 use strict;
robert@0 7 use CGI::Ajax;
robert@0 8 use CGI;
robert@0 9
robert@0 10 my $q = new CGI;
robert@0 11
robert@0 12 # the format here implies that 'convert_degrees.pl' is at the same
robert@0 13 # level in the web server's document root as this script.
robert@0 14 my $pjx = CGI::Ajax->new( 'myfunc' => 'convert_degrees.pl');
robert@0 15 $pjx->JSDEBUG(1);
robert@0 16
robert@0 17 my $Show_Form = sub {
robert@0 18 my $html = "";
robert@0 19 $html .= <<EOT;
robert@0 20 <HTML>
robert@0 21 <HEAD><title>CGI::Ajax Outside URL Example</title>
robert@0 22 </HEAD>
robert@0 23 <BODY>
robert@0 24 <form>
robert@0 25 Degrees Centigrade:&nbsp;
robert@0 26 <input type="text" name="val1" id="val1" size="6"
robert@0 27 onkeyup="myfunc( ['Centigrade__' + getVal('val1')], ['val2'] );
robert@0 28 return true;">
robert@0 29 <br/>
robert@0 30
robert@0 31 Degrees Kelvin:&nbsp;
robert@0 32 <input type="text" name="val2" id="val2" size="6"
robert@0 33 onkeyup="myfunc( ['Kelvin__' + getVal('val2')], ['val1'] );
robert@0 34 return true;">
robert@0 35 </form>
robert@0 36 </BODY>
robert@0 37 </HTML>
robert@0 38 EOT
robert@0 39
robert@0 40 return $html;
robert@0 41 };
robert@0 42
robert@0 43 print $pjx->build_html($q,$Show_Form); # this outputs the html for the page