<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获取PHP页面的值
- windows中的IP与子网掩码按照什么算法来确定有效性的
- 根据DIV的CLICK边框显示问题
- 表格定位
- 问一个浏览器兼容性的脚本问题
- 中国天气网接口返回的json数据中 img1-img12中有些数字为99
- 判断ActiveX控件的版本号
- 如何响应后退事件
- 都在说wijmo5的架构很优秀,具体是在哪些方面?有人能解答一下么?
- jquery的datagrid的combobox,如何在点击一个按钮后,让combox中的下拉列表的值value变成指定的值。
- 怎么在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>