![复制代码](https://i-blog.csdnimg.cn/blog_migrate/48304ba5e6f9fe08f3fa1abda7d326ab.gif)
<script type="text/javascript">
function checkform() {
var re;
var ss = document.getElementById('txtMobile').value;
re = /^(1[358][0-9]{9})$/;
if (re.test(ss)==false) {
alert("手机号码输入不合法");
return false;
}
var id=document.getElementById("txtIDNUMBER").value;
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (reg.test(id) === false) {
alert("身份证输入不合法");
return false;
}
}
function setpawd(){
var paw1 = $(".pw_li input").val();
var paw2 = $(".repw_li input").val();
if (paw1 == "") {
alert("请输入登录密码")
}else if(paw2== ""){
alert("请输入确认密码")
}else {
if (paw1 != paw2) {
$(".repw_li input").empty();
alert("两次密码不一致,请重新输入1")
}
if (paw1.length <= 6||paw1.length>=12) {
$(".repw_li input").empty();
alert("密码长度要大于等于6,小于12.")
}
if (paw1.length >= 8&&paw1.length<=12) {
var letter = 0, num = 0;
for (var a = 0; a < paw1.length; a++) {
if ((paw1[a] >= 'A' && paw1[a] <= 'Z') || (paw1[a] >= 'a' && paw1[a] <= 'z')) letter++;
else if (paw1[a] >= '0' && paw1[a] <= '9') num++;
}
if (letter && num) {
$.ajax({
url: 'h5_updatePwd.html',
type: 'post',
data: 'password=' + paw1 ,
async: false, //默认为true 异步
error: function () {
alert("查询异常");
window.location.href = "setPass.html";
},
success: function (data) {
var flag = JSON.stringify(data.success);
if (flag == 'true') {
$.toptip(JSON.stringify(data.content), 3000, 'error');
window.location.href = "login_h5.html";
}
else {
$.toptip(JSON.stringify(data.content), 3000, 'error');
}
}
});
} else {
$(".repw_li input").empty();
alert("密码要求数字与字母组合,请重新输入!");
}
}
}
}
</script>