js confirm执行问题
当点击“确认”时为什么不显示response.Write(asdglkasdlg),而显示的是“99999”,如果要显示response.Write(asdglkasdlg),该如何改confirmadd()函数?
- HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><script language="javascript">function confirmadd(){if(confirm("您预约的时间段已经被占用,点确认继续预约,点‘取消’取消预约。"))return true;else{window.location.href="test.asp";}}</script><body>1111<% a=1if a=1 then%><script language="javascript">confirmadd();</script><%response.Write(asdglkasdlg)a=2elseresponse.Write(33333333333333333333)end if%>99999</body></html>[解决办法]
字符串要加引号,否则是变量
response.Write "asdglkasdlg"
[解决办法]
<%
a=1
if a=1 then
%>
<%
response.Write(asdglkasdlg)
a=2
else
response.Write(33333333333333333333)
end if
%>
这些语句根本就没执行。。
[解决办法]
a=1
if a=1 then这句永远正确呀
不管点什么都是客户端代码,客户端代码执行的时候,asp代码已经在服务器端执行完毕了