<html>
<body>
<script>
function check()
{
if (p1.value==p2.value){alert('密码相等');}
else alert('密码不等');
}
</script>
<input type=password name=p1><br>
<input type=password name=p2><br>
<input type=button value=检验 onclick=check()>
</body>
</html>
<body>
<script>
function check()
{
if (p1.value==p2.value){alert('密码相等');}
else alert('密码不等');
}
</script>
<input type=password name=p1><br>
<input type=password name=p2><br>
<input type=button value=检验 onclick=check()>
</body>
</html>
解决方案 »
- js读取Excel的日期格式的单元格
- ext中分页时,PagingToolbar中显示‘page()of’ 怎样变成中文?
- JS如何实现翻页功能???
- js中怎么避免为空或者不是对象的错误啊?
- 关于原型链+对象冒充方式实现继承的一点疑问
- 关于浏览器地址的获取,在线等,谢谢
- ScriptX.cab控件怎么使用?
- 求助在线考试-jsp网页源代码
- 关于正则表达式的问题
- 为什么我现在打开每个文件夹都会自动生成两个文件,好像是一段vbsctict程序。我用文本打,内容如下:开
- 怎么在javascript中设定图片的链接?
- “为什么不能用鼠标选中我”谁能帮忙解决用鼠标选取层下面文字,你要多少分给你多少!!!
id=password2 name=password2 type=password>
{
if(theForm.inputUserPassword.value==theForm.repassword.value)
{
return (true);
}
else
{
alert("两次密码不一致,请重新输入");
theForm.inputUserPassword.value="";
theForm.repassword.value="";
return (false);
}
}
<form name="form1" method="post" action="insert.php" onSubmit="return repassword(form1)">
为什么不执行我得javascript
js代码要在<script>和</script>之中!
<HEAD>
<title>test</title>
<script language="javaScript">
function issapce()
{
if (document.book.password.value=="")
{
alert ("请输入您的密码 !")
document.book.password.focus();
return false
}
if (document.book.password.value.length<4)
{
alert ("您的密码太短了!")
document.book.password.focus();
document.book.password.value="";
document.book.repassword.value="";
return false
}
if (document.book.repassword.value=="")
{
alert ("请输入您的重复密码!")
document.book.repassword.focus();
return false
}
if (document.book.password.value!=document.book.repassword.value)
{
alert ("两次密码不一致 !");
document.book.password.focus();
document.book.password.value="";
document.book.repassword.value="";
return false;
}
return true;
}
function validIfo()
{
if(!issapce()) return false;
}
</script>
</HEAD>
<BODY>
<form action="" name="book" onSubmit="return validIfo()" method="post">
<table width="90%" cellspacing="2" border="0" align="center" cellpadding="3">
<tr>
<td width="128"><font color="#FF0000">*</font>密码:</td>
<td width="262">
<input type="password" size=30 name="password">
</td>
<td width="268">→ 密码至少4位,区分大小写。</td>
</tr>
<tr>
<td width="128"><font color="#FF0000">*</font>重复密码:</td>
<td colspan="2">
<input type="password" size=30 name="repassword">
</td>
</tr>
<tr><td>
<input type="submit" value="下一步>>" name="submit">
</td><td></td></tr>
</table>
</form>
</BODY>
</HTML>