为什么我javascript程序无法执行?
为什么我javascript程序无法执行?页面中的form好像根本没有通过js验证,直接就提交了表单!!不知道为什么,代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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 check()
{
if(document.form.newpwd.value.length==0)
{
alert("新密码不能为空!");
document.form.newpwd.focus();
return false;
}
if(document.form.newpwd2.value.length==0)
{
alert("新密码不能为空!");
document.form.newpwd2.focus();
return false;
}
if(document.form.newpwd.value<>document.form.newpwd2.value)
{
alert("新密码两次输入不同!");
document.form.newpwd.focus();
return false;
}
}
//-->
</script>
</head>
<body>
<p>
</p>
<form id="form" name="form" method="post" action="updatepwd.asp" onsubmit="return check()">
<p>用户名
:<%=session("user_name")%> </p>
<p>旧密码:
<label>
<input name="oldpwd" type="password" id="oldpwd" />
</label>
</p>
<p>新密码:
<label>
<input name="newpwd" type="password" id="newpwd" />
</label>
</p>
<p>确认新密码:
<label>
<input name="newpwd2" type="password" id="newpwd2" />
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="确认" />
</label>
<label>
<input type="reset" name="Submit2" value="重设" />
</label>
</p>
</form>
<p> </p>
</body>
</html>