62,266
社区成员
发帖
与我相关
我的任务
分享
/*
===========================================
//是否是手机
===========================================
*/
String.prototype.isMobile = function()
{
return /^0{0,1}1[3,5,8][0-9]{9}$/.test(this);
}
/*
===========================================
//是否是有效的电话号码(中国)
===========================================
*/
String.prototype.isPhoneCall = function()
{
return /(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/.test(this);
}
function checkform()
{
var phone=document.getElementById("<%=txtPhone.ClientID %>");
if(!phone.value.isPhoneCall() && !phone.value.isMobile())
{
alert("不是有效的电话号码!")
return false;
}
}