annotate BoosterPack/scripts/.svn/text-base/pjx_from_span.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
rev   line source
rlm@0 1 #!C:/strawberry/perl/bin/perl.exe
rlm@0 2
rlm@0 3 use strict;
rlm@0 4 use warnings;
rlm@0 5
rlm@0 6 use CGI;
rlm@0 7 use CGI::Ajax;
rlm@0 8
rlm@0 9 my $cgi= CGI->new;
rlm@0 10
rlm@0 11 my $a= CGI::Ajax->new(
rlm@0 12 'test_elt_html' => \&test_elt_html
rlm@0 13 );
rlm@0 14
rlm@0 15 $a->DEBUG(2);
rlm@0 16 $a->JSDEBUG(2);
rlm@0 17
rlm@0 18 print $a->build_html( $cgi, \&html_page);
rlm@0 19
rlm@0 20 sub html_page
rlm@0 21
rlm@0 22 {
rlm@0 23 return <<EOH;
rlm@0 24 <html>
rlm@0 25 <head>
rlm@0 26 <script>
rlm@0 27 function test2(){
rlm@0 28 alert(typeof document.getElementById('newtest'));
rlm@0 29 }
rlm@0 30 </script>
rlm@0 31
rlm@0 32 </head>
rlm@0 33
rlm@0 34 <body>
rlm@0 35 <div id="test_div">test with div</div>
rlm@0 36 <p><span id="test_span">test with span</span></p>
rlm@0 37 <p id="test_p">test with p</p>
rlm@0 38
rlm@0 39 <div id='newtest' > some stuff </div>
rlm@0 40 <hr />
rlm@0 41
rlm@0 42 <p><input type="button" onclick="test_elt_html( [ 'test_div' ], [ 'test_result_div' ]);" value="test div"></p>
rlm@0 43 <div id="test_result_div"></div>
rlm@0 44
rlm@0 45 <p><input type="submit" onclick="test_elt_html( [ 'test_span' ], [ 'test_result_span' ]);" value="test span"></p>
rlm@0 46 <div id="test_result_span"></div>
rlm@0 47
rlm@0 48 <p><input type="submit" onclick="test2();test_elt_html( [ 'newtest' ], [ 'test_result_p' ]);" value="test p"></p>
rlm@0 49 <div id="test_result_p"></div>
rlm@0 50
rlm@0 51 </body>
rlm@0 52 </html>
rlm@0 53 EOH
rlm@0 54 ;
rlm@0 55
rlm@0 56 }
rlm@0 57
rlm@0 58
rlm@0 59 sub test_elt_html
rlm@0 60 { my( $elt_html)= @_;
rlm@0 61 print STDERR "IN:" . $elt_html , "\n";
rlm@0 62 return $elt_html;
rlm@0 63 }
rlm@0 64