如何在浏览器上加载html页面时运行perl脚本。我试图运行perlscript onload(),甚至将它写在头上。但没有奏效 perl脚本:在加载html页面上运行perl脚本
#!/usr/bin/perl -w
use strict;
use CGI ':standard';
use warnings;
use FileHandle;
my $result="sakshi";
open(OUT,'>/var/cgi-bin/sample.html');
print
OUT header(),
start_html(
-title => 'Command',
-text => '#520063'
);
print OUT "Hello $result";
print OUT end_html();
close(OUT);
事情,我在HTML曾尝试:
1.
<head>
<title>test</title>
<script src="common_info.pl"></script>
</head>
2.
<body onload=call_perl()">
<script text/javascript>
function call_perl(){
var ajax = new XMLHttpRequest;
ajax.open("GET", "http://localhost/cgi-bin/myscript.pl", true);
ajax.send();
}
</script>
你想完成什么?发布的代码没有任何意义。 –