标签:
1. validation
//检测手机号码是否合法 function isPhone(phone){ var phone = (phone+"").trim(); var reg = /^1[34568]{1}\d{9}$/; var flag = false; if (phone != null && phone.length > 0){ (flag = reg.test(phone)) ? true : false; } return flag; } //检测邮箱是否合法 function isEmail(email){ var phoneNum = (email+"").trim(); var reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/; var flag = false; if (email != null && email.length >0) { (flag = reg.test(email)) ? true : false; } }
标签:
原文地址:http://www.cnblogs.com/bravolove/p/5743555.html