邮箱 手机号 验证

//必选项背景色 手机号为必选项
function invoicedt(){
var areaSum = document.getElementById("phone_number").value;

if(null!=areaSum || areaSum!=""){
document.getElementById("phone_number").style.backgroundColor = "white";
}
if(null==areaSum || areaSum==""){
//$.messager.alert('提示', "电话是必填项!");
document.getElementById("phone_number").style.backgroundColor = "#fff3f3";
}

}
//邮箱设置为必选项
function invoicedtEimal(){
var areaSum = document.getElementById("email_no").value;

if(null!=areaSum || areaSum!=""){
document.getElementById("email_no").style.backgroundColor = "white";
}
if(null==areaSum || areaSum==""){
//$.messager.alert('提示', "电话是必填项!");
document.getElementById("email_no").style.backgroundColor = "#fff3f3";
}

}

//验证邮箱
function emailLimit() {

var Email = $("#email_no").val();
if(null != Email && "" != Email){
var ret = /^([a-z0-9A-Z]+[-_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/;
if (!ret.test(Email)) {
$.messager.alert("提示", "请输入格式正确的邮箱!", "info");
$("#email_no").val("");
}
}
}

//验证邮箱 添加
function checkemail() {
var Email = $("#email_no").val();
if(null != Email && "" != Email){
var ret = /^([a-z0-9A-Z]+[-_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/;
if (!ret.test(Email)) {
$.messager.alert("提示", "请输入格式正确的邮箱!", "info");
$("#email_no").val("");
}
}
}

//电话验证 添加
function mblLimit() {
var mblNo = $("#phone_number").val();
if(null != mblNo && "" != mblNo){

var ret = /^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9]|9[0-9]])\d{8}$/;
if (!ret.test(mblNo)) {
$.messager.alert("提示", "请输入格式正确的手机!", "info");
$("#phone_number").val("");
}
}
}

posted @ 2019-12-31 16:02  红尘沙漏  阅读(242)  评论(0编辑  收藏  举报