日期:2014-05-16 浏览次数:20469 次
function getVal(id)
{
if (document.getElementById("Tel").value != ""){
var phone=document.getElementById("Tel").value;
var reg = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
if (!reg.test(phone)){
document.getElementById("Tel").value='';
alert('对不起,您输入的电话号码有错误。区号和电话号码之间请用-分割');
document.getElementById("Tel").focus();
return false;
}
}
if (document.getElementById("Mobile").value != ""){
var mobile=document.getElementById("Mobile").value;
var reg0 = /^13\d{5,9}$/;
var reg1 = /^15[0-35-9]\d{4,8}$/;
var reg2 = /^18[05-9]\d{4,8}$/;
var reg3 = /^0\d{10,11}$/;
var my = false;
if (reg0.test(mobile))my=true;
if (reg1.test(mobile))my=true;
if (reg2.test(mobile))my=true;
if (reg3.test(mobile))my=true;
if (!my){
document.getElementById("Mobile").value='';
alert('对不起,您输入的手机号码有错误。');
document.getElementById("Mobile").focus();
return false;
}else
{
if(document.getElementById('StripImg').value=='')
{
$('#CreateStripImg').click(function(){CreateStripImg();});
$('#CreateStripImg').click();
}
}
return true;
}
}
<input class="textbox" size=21 name="Mobile" id="Mobile" value="<%=Mobile%>" onblur="getVal(this.id)" />