b*h 发帖数: 353 | 1 问题1:JAVASCRIPT 能否连接数据库(mySQL)?
问题2:能否把 Javascript 嵌入在 Perl code 中(Perl for CGI),我曾作了简单测试
但不成功, 下面是code:
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $teststring = 'This is content from Perl';
my @testarray = ('item1', 'item2', 'item3');
print <
print "Content-type: text/javascript";
alert('Soon, I will rebuild my browser!')
END
for (0..$#testarray) {
print <
document.write ('$testarray[$_] \\\\n')
END
}
Please help, th | p******f 发帖数: 162 | 2
yes, you can use perl to generate whatever document you want, including
javascript, just remember, the output of perl program is what will be
sent to the browser, so make sure it is valid document.
【在 b*h 的大作中提到】 : 问题1:JAVASCRIPT 能否连接数据库(mySQL)? : 问题2:能否把 Javascript 嵌入在 Perl code 中(Perl for CGI),我曾作了简单测试 : 但不成功, 下面是code: : #!/usr/bin/perl -w : use strict; : use CGI; : use CGI::Carp qw(fatalsToBrowser); : my $teststring = 'This is content from Perl'; : my @testarray = ('item1', 'item2', 'item3'); : print <
|
|