<mce:script language="javascript" type="text/javascript"><!-- String.prototype.Trim = function() { return this.replace(/(^/s*)|(/s*$)/g, ""); } function check() { //检查用户名 var userId = document.getElementById("txtUserId").value; userId = userId.Trim(); if (!isRegisterUserName(userId)) { alert("用户名格式不正确!"); return false; } //检查密码 var password = document.getElementById("txtPwd").value; password = password.Trim(); if (!isPasswd(password)) { alert("密码格式不正确!"); return false; } //密码确定 var rPassword = document.getElementById("txtPwdRp").value; rPassword = rPassword.Trim(); if (password != rPassword) { alert("前后密码不匹配!"); return false; } //检查真实姓名 var trueName = document.getElementById("txtTrueName").value; trueName = trueName.Trim(); if (!isTrueName(trueName)) { alert("请输入真确的真实姓名!"); return false; } //检查部门 var department = document.getElementById("txtDepartment").value; department = department.Trim(); department = department.Trim(); if (department == "") { alert("还没有选择部门!"); return false; } //检查办公电话 var tel = document.getElementById("txtTel").value; tel = tel.Trim(); if (tel != "") { if (!isNums(tel)) { alert("办公电话格式不正确!"); return false; } } //检查手机号码 var motel = document.getElementById("txtMotel").value; motel = motel.Trim(); if (motel != "") { if (!isMotel(motel)) { alert("手机号码格式不正确!"); return false; } } //检查qq var qq = document.getElementById("txtQ").value; qq = qq.Trim(); if (qq != "") { if (!isQQ(qq)) { alert("qq号格式不正确!"); return false; } } //检查邮箱 var meil = document.getElementById("txtMeil").value; meil = meil.Trim(); if (meil != "") { if (!isEmail(meil)) { alert("邮箱地址格式不正确!"); return false; } } return true; } //校验登录名:只能输入5-20个以字母开头、可带数字、“_”、“.”的字串 function isRegisterUserName(s) { var patrn = /^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/; if (!patrn.exec(s)) return false return true } //校验密码:只能输入6-20个字母、数字、下划线 function isPasswd(s) { var patrn = /^(/w){6,20}$/; if (!patrn.exec(s)) return false return true } //校验用户排序:只能输入正整数 function isNums(s) { var patrn = /^[0-9]{1,}$/; if (!patrn.exec(s)) return false; return true; } //校验用户真名:只能输入中文汉字或英文,可带"_"、"."、空格 function isSB(s) { var patrn = /^([/u4e00-/u9fa5]{1,}|([a-z ._A-Z]{1,}$))/; if (!patrn.exec(s)) return false; return true; } //校验手机号码:只能输入韶关移动的手机号码 function isMotel(s) { var patrn=/^1[35][012456789][0-9]{8}$/; if(!patrn.exec(s))return false; return true; } //校验qq function isQQ(s) { var patrn=/[1-9][0-9]{4,}/; if(!patrn.exec(s))return false; return true; } //校验Email地址 function isEmail(s) { var patrn = //w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*/; if (!patrn.exec(s)) return false; return true; } // --></mce:script>