代码检查错误

来源:百度知道 编辑:UC知道 时间:2024/05/12 00:37:54
<%
StudentID=Request("StudentID")
Name=Request("Name")
Subject=Request("Subject")
if StudentID="" then %>
<script language=vbscript>
MsgBox "错误:请输入你的学号!"
location.href = "javascript:history.back()"
</script>

<%
end if
if Name="" then%>
<script language=vbscript>
MsgBox "错误:请输入你的姓名!"
location.href = "javascript:history.back()"
</script>
<%end if%>

这段代码没有起作用,也就是说我用户名和密码为空不弹出窗口

楼上的不对,==是javascript脚本里的比较符。
这样写:
<%if StudentID="" then %>
<script language=javascript>
alert("错误:请输入你的学号!" );
history.back();
</script>

<% response.end()'这句话不能省略。
end if

if StudentID="" then %>
是要StudentID==""
"="是赋值的意思
"=="是等值的意思
同样的name那里也是