File: pjx_from_span.pl

package info (click to toggle)
libcgi-ajax-perl 0.707-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,669; makefile: 2
file content (64 lines) | stat: -rwxr-xr-x 1,229 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/perl

use strict;
use warnings;

use CGI;
use CGI::Ajax;

my $cgi= CGI->new;

my $a= CGI::Ajax->new( 
                       'test_elt_html'  => \&test_elt_html
                     );

$a->DEBUG(2);
$a->JSDEBUG(2);

print $a->build_html( $cgi, \&html_page);

sub html_page

  { 
return <<EOH;
<html> 
<head> 
<script>
function test2(){
    alert(typeof document.getElementById('newtest'));  
}
</script>

</head>

  <body>
    <div id="test_div">test with div</div>
    <p><span id="test_span">test with span</span></p>
    <p id="test_p">test with p</p>
    
    <div id='newtest' > some stuff </div>
    <hr />

    <p><input type="button" onclick="test_elt_html( [ 'test_div' ], [ 'test_result_div' ]);" value="test div"></p>
    <div id="test_result_div"></div>

    <p><input type="submit" onclick="test_elt_html( [ 'test_span' ], [ 'test_result_span' ]);" value="test span"></p>
    <div id="test_result_span"></div>

    <p><input type="submit" onclick="test2();test_elt_html( [ 'newtest' ], [ 'test_result_p' ]);" value="test p"></p>
    <div id="test_result_p"></div>

</body>
</html>
EOH
;

  }


sub test_elt_html
  { my( $elt_html)= @_;
  print STDERR "IN:" . $elt_html , "\n";
    return $elt_html;
  }