无为清净楼资源网 Design By www.qnjia.com

复制代码 代码如下:
<?php
echo <<<JS //使用多行输出的方法输出JavaScript代码
<SCRIPT Language = "JavaScript">
function func()
{
if(confirm("Are you OK with this?"))
{
document.write("I'm OK!");
}
else
{
document.write("I'm not OK!");
}
}
</SCRIPT>
JS;
?>
<html>
<head>
</head>
<body>
<a href="#" href="#" onClick="javascript:func();">Please Click</a>
</body>
</html>

复制代码 代码如下:
<?php
$confirm = "Are you OK with this?"; //定义确认框上的信息
$ok_msg = "I'm OK!"; //OK时的信息
$not_ok_msg = "I'm not OK!"; //Cancel时的信息

echo "<SCRIPT Language = \"JavaScript\">"; //开始逐行输出JavaScript代码
echo "function func()";
echo "{";
echo "if(confirm(\"Are you OK with this?\"))";
echo "{";
echo "document.write(\"I'm OK!\");";
echo "}";
echo "else";
echo "{";
echo "document.write(\"I'm not OK!\");";
echo "}";
echo "}";
echo "</SCRIPT>"; //输出结束
?>
<html>
<head>
</head>
<body>
<a href="#" href="#" onClick="javascript:func();">Please Click</a>
</body>
</html>

标签:
php,动态生成,JavaScript

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com