<script type="text/javascript">
$(function(){
$("#id_new_password1").attr("maxlength",6); //控件的最大长度为6
});
});
function test(){
var password = document.getElementById('id_new_password1').value;
if (password.match(/\d/) && password.match(/[a-zA-Z]/ && password.length == 6)){
return true;
}
else{
alert("您输入的密码至少包含一个数字和一个字母!");
return false;
}
}
</script>
JS 判断密码输入框输入的内容为六位,并且至少含有一个数字和字母
最新推荐文章于 2023-05-25 13:14:16 发布