Sou*_*mya 2 javascript perl jquery cgi heredoc
是否可以在perl的here-doc部分中包含JQuery.我试过但没有成功.这是我的代码.
my $cgi = CGI->new();print header();print start_html("JQuery in perl");
print <<JS;
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script><!--
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
//--></script>
<p>Click to hide</p>
<p>Click to hide</p>
<p>Click to hide</p>
</body>
JS
print end_html();
Run Code Online (Sandbox Code Playgroud)
但是当我编写一个javascript函数时,它工作正常
my $cgi = CGI->new();print header();print start_html("hello");
print <<JS;
<script><!--
function show() {alert("Hello");}
//--></script>
<input type="button" value="Check" onclick="show()">
</body>
JS
print end_html();
Run Code Online (Sandbox Code Playgroud)
我错过了一些明显的东西吗?请建议.
| 归档时间: |
|
| 查看次数: |
502 次 |
| 最近记录: |