[求助]为什么要提交?
											
运行下面的代码(register.asp),当NAME为空时,ALERT出现,但点"确定"后,却提交到index.asp页.请指点
<body>
<form name="form1" method="post" action="index.asp" onSubmit="return(check())">
  <p>
    <input name="name" type="text" id="name">
  </p>
  <p>    <input name="pwd" type="text" id="psw">
</p>
  <p>
    <input type="submit" name="Submit" value="提交">
</p>
</form>
<script language="vbscript">
function check()
if document.form1.name.value="" then
alert("用户名不能为空!")
document.form1.name.focus()
return false
end if
if document.form1.pwd.value="" then
alert("密码不能为空!")
document.form1.pwd.focus()
return false
end if
return true
end function
</script>
</body>
[此贴子已经被作者于2006-12-2 20:59:20编辑过]



											
	    

	