欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery驗(yàn)證手機(jī)號碼、郵箱格式是否正確示例代碼

 更新時(shí)間:2013年07月28日 15:22:54   作者:  
本文為大家介紹下使用jquery驗(yàn)證郵箱、驗(yàn)證手機(jī)號碼,具體實(shí)現(xiàn)思路及代碼如下,感興趣的朋友可以學(xué)習(xí)下
復(fù)制代碼 代碼如下:

//jquery驗(yàn)證郵箱
function checkSubmitEmail() {
if ($("#email").val() == "") {
//$("#confirmMsg").html("<font color='red'>郵箱地址不能為空!</font>");
alert("郵箱不能為空!")
$("#email").focus();
return false;
}
if (!$("#email").val().match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)) {
alert("郵箱格式不正確");
//$("#confirmMsg").html("<font color='red'>郵箱格式不正確!請重新輸入!</font>");
$("#email").focus();
return false;
}
return true;
}

//jquery驗(yàn)證手機(jī)號碼
function checkSubmitMobil() {
if ($("#mobile").val() == "") {
alert("手機(jī)號碼不能為空!");
//$("#moileMsg").html("<font color='red'>手機(jī)號碼不能為空!</font>");
$("#mobile").focus();
return false;
}

if (!$("#mobile").val().match(/^(((13[0-9]{1})|159|153)+\d{8})$/)) {
alert("手機(jī)號碼格式不正確!");
//$("#moileMsg").html("<font color='red'>手機(jī)號碼格式不正確!請重新輸入!</font>");
$("#mobile").focus();
return false;
}
return true;
}

相關(guān)文章

最新評論