<html>
<body>
<script>
function lost(){
var input=document.getElementById("pas");
var input_value=input.value;
alert(input_value)
var patrn =/(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9]{8,12}/;
input_value=input_value.replace(/(^\s*)|(\s*$)/g, "");
if(!(patrn.test(input_value))){
alert("密码必须是字母和数字组合,不能为纯数字或字母!");
}
}
</script>
<input id="pas" οnblur="lost()"/>
</body>
</html>
<body>
<script>
function lost(){
var input=document.getElementById("pas");
var input_value=input.value;
alert(input_value)
var patrn =/(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9]{8,12}/;
input_value=input_value.replace(/(^\s*)|(\s*$)/g, "");
if(!(patrn.test(input_value))){
alert("密码必须是字母和数字组合,不能为纯数字或字母!");
}
}
</script>
<input id="pas" οnblur="lost()"/>
</body>
</html>