<body>
<form action=login.asp method=post name=dlform>
<table width=300 border=1 bordercolor=blue align=center>
<tr>
<td colspan=2 align=center>用户登</td>
</tr>
<tr>
<td align=right width=100>用户名:</td><td width=200 align=left maxlength=3><Input type=text name=username></td>
</tr>
<tr>
<td align=right width=100>密 码:</td><td width=200><Input type=password name=pass></td>
</tr>
<tr>
<td colspan=2 align=center>
<Input type=button value=提交 onclick=check()>
<Input type=reset value=重置>
</td>
</tr>
</table>
</form>
<script language=vbscript>
sub check()
if document.dlform.username.value=" " then
msgbox"请输入用户名,48"
document.dlform.username.focus()
else if
document.dlform.pass.value=" " then
msgbox"请输入密码"
document.dlform.pass.focus()
else
document.dlform.submit
end if
end sub
</script>
</body>
我把登陆页面的表单代码和检测代码卸载了同一页面,但他不会检测。就相当没这段代码:
<script language=vbscript>
sub check()
if document.dlform.username.value=" " then
msgbox"请输入用户名,48"
document.dlform.username.focus()
else if
document.dlform.pass.value=" " then
msgbox"请输入密码"
document.dlform.pass.focus()
else
document.dlform.submit
end if
end sub
</script>,为什么这段代码没效果啊。