<body>
<script language="javascript">
function checkfrm(){
var pass1=document.getElementById("password").value
var pass2=document.getElementById("password2").value
if(pass1!=pass2)
{
alert("你输入的密码不一样!")
return false
}
return true
}
</script><form id="form1" name="form1" method="post" action="">
<label>
<input name="password" type="text" id="password" value="" size="45" />
</label>
<p>
<label>
<input name="password2" type="text" id="password2" value="" size="45" />
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="提交" onclick="checkfrm()"/>
</label>
</p>
</form>
</body>-----------------------------------------------------------
方法二:
<body>
<script language="javascript">
function checkfrm(){
if(document.form1.password.value!=document.form1.password2.value)
{
alert("你输入的密码不一样!")
return false
}
return true
}
</script><form id="form1" name="form1" method="post" action="">
<label>
<input name="password" type="text" id="password" value="" size="45" />
</label>
<p>
<label>
<input name="password2" type="text" id="password2" value="" size="45" />
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="提交" onclick="checkfrm()"/>
</label>
</p>
</form>
</body>
其实,理论上是一样的,写个判断就可以了嘛,跟C#\Java里差不多,大同小异而已...如果还解决不了的话,加我Q:418364419 ,我Q远程协助教你!
<script language="javascript"><!--
function f(){
var password2=document.getElementById("password2")
var password=document.getElementById("password")
if(password2.value!=password.value){
alert("密码不一样,请重新输入")
return false
}
}
-->
</script>
<body>
密码:<input name="password" type="password" id="password" />
确认密码:<input name="password2" type="password" id="password2" /></body>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)