//正则验证手机号码 function isPhoneNum(value){ return /^1[345678]\d{9}$/.test(value); }; //正则验证邮箱 function isEmail(value){ return /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(value); }
function chk() { var patrn = /^\d+(\.\d+)?$/; var result = true; $("input[type=text]").each(function () { if (!patrn.exec(this.value)) { alert("请输入正确的数字!"); result = false; } }) return result; }
var countdown=60; function settime(val) { if (countdown == 0) { val.removeAttribute("disabled"); val.value="发送验证码"; countdown = 60; }else { val.setAttribute("disabled", true); val.value="重新发送(" + countdown + ")"; countdown--; setTimeout(function() { settime(val) },1000) } }