复制代码 代码如下: echo <BR>function func() <BR>{ <BR>if(confirm("Are you OK with this?")) <BR>{ <BR>document.write("I'm OK!"); <BR>} <BR>else <BR>{ <BR>document.write("I'm not OK!"); <BR>} <BR>} <BR> JS; ?> Please Click 复制代码 代码如下: $confirm = "Are you OK with this?"; //定义确认框上的信息 $ok_msg = "I'm OK!"; //OK时的信息 $not_ok_msg = "I'm not OK!"; //Cancel时的信息 echo ""; //开始逐行输出JavaScript代码 <BR>echo "function func()"; <BR>echo "{"; <BR>echo "if(confirm(\"Are you OK with this?\"))"; <BR>echo "{"; <BR>echo "document.write(\"I'm OK!\");"; <BR>echo "}"; <BR>echo "else"; <BR>echo "{"; <BR>echo "document.write(\"I'm not OK!\");"; <BR>echo "}"; <BR>echo "}"; <BR>echo ""; //输出结束 ?> Please Click