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