简单的50分题

spindrift 2002-05-08 04:05:01
<html>
<head>
<title>申请帐号网页</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>

<body bgcolor="#FFFFFF" text="#000000">
<!--<form action="FineGold.jsp" method="post" name="form">-->
<form>
用户名称:<input type="text" name="id" size=20>*<br>
用户密码:<input type="password" name="pass1" size=20>*<br>
确认密码:<input type="password" name="pass2" size=20>*<br>
<input type="button" name="button" value="提交" onClick="Same(this.form");">
<input type="reset" name="reset" value="清除">
</form>
</body>
<script language="JavaScript">
function Same(){
alter("aaaaaaaaaa");
if (document.form.pass1.value<>document.form.pass2.value){
alter("The password is same,please fill again!");
document.form.pass1.focus();}
}
</script>
</html>

为什么条件语句不能实现?
...全文
27 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weidegong 2002-05-08
  • 打赏
  • 举报
回复
<form name=frmshow>
用户名称:<input type="text" name="id" size=20>*<br>
用户密码:<input type="password" name="pass1" size=20>*<br>
确认密码:<input type="password" name="pass2" size=20>*<br>
<input type="button" name="button" value="提交" onClick="Same(this.form)");">
<input type="reset" name="reset" value="清除">
</form>
</body>
<script language="JavaScript">
function Same(){
if (document.frmshow.pass1.value!=document.frmshow.pass2.value){
alert("The password is same,please fill again!");
document.frmshow.pass1.focus();
document.frmshow.pass1.select();
}
}
</script>
yaya123 2002-05-08
  • 打赏
  • 举报
回复
把条件改成:
document.all.pass1.value!=document.all.pass2.value

document.all.pass1.focus();

注意javascript中的 == 与 !=

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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