为什么我javascript程序无法执行?

crash_linkin 2007-05-02 01:00:37
为什么我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>


...全文
262 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangwm 2007-05-02
  • 打赏
  • 举报
回复
<%@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>

整个复制过去看看
crash_linkin 2007-05-02
  • 打赏
  • 举报
回复
谢谢!!!!wangwm,问题已经解决,原来是基本语法记错了,唉~~~~万分感谢
kivetja 2007-05-02
  • 打赏
  • 举报
回复
完全同意wangwm
glvicky 2007-05-02
  • 打赏
  • 举报
回复
UP
wangwm 2007-05-02
  • 打赏
  • 举报
回复
if(document.form.newpwd.value!=document.form.newpwd2.value)
{
alert("新密码两次输入不同!");
document.form.newpwd.focus();
return false;
}
crash_linkin 2007-05-02
  • 打赏
  • 举报
回复
js验证好像根本没有用,根本没有弹出消息框,请各位大虾们帮帮忙

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧