<!--
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>
用正则表达式吧<SCRIPT type="text/javascript">
function checkUserName(userName){
var reg = /^[a-z\d]{6,12}/// 小写字母
return reg.test(userName)
}
function checkPassword(userPassword){
var reg = /^\d{6}$/// 数字
return reg.test(userPassword)
}
//alert(checkUserName('adf'))
//alert(checkPassword('1212122'))
</SCRIPT>