﻿function check() {

    var p = /^([0-9a-zA-Z]{6,12})$/g;
    if (!p.test(document.getElementById("userName").value)) {
        alert("用户名格式不正确,长度为6-12位\r\n例如:abcd123");
        document.getElementById("userName").focus();
        return false;
    }

    var p1 = /^([0-9a-zA-Z]{6,12})$/g;
    if (!p1.test(document.getElementById("userPwd").value)) {
        alert("密码格式不正确,长度为6-12位\r\n例如:abcd123");
        document.getElementById("userPwd").focus();
        return false;
    }
} 
