Skip to content

Instantly share code, notes, and snippets.

@zsmynl
Created September 28, 2015 17:49
Show Gist options
  • Save zsmynl/0285297fb0ceb9bb7725 to your computer and use it in GitHub Desktop.
Save zsmynl/0285297fb0ceb9bb7725 to your computer and use it in GitHub Desktop.
<script>
function isEmail(strEmail)
{
if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return false;
else
return true;
}
function isMobel(value)
{
if(/^13\d{9}$/g.test(value)||(/^15[0-35-9]\d{8}$/g.test(value))|| (/^18[05-9]\d{8}$/g.test(value)))
{ return false; }
else
{ return true; }
}
function checkfrm()
{
if($("#rname").val()=='' || $("#rname").val()==null){
alert('请填写您的姓名');
return false;
}else if($("#mob").val()=='' || $("#mob").val()==null){
alert('请填写手机号码');
return false;
}else if(isMobel($("#mob").val())){
alert('请填写正确的手机号码');
return false;
}else if($("#email").val()=='' || $("#email").val()==null){
alert('请填写您的邮箱');
return false;
}else if(isEmail($("#email").val())){
alert('请填写正确的邮箱地址');
return false;
}else if($("#likecar").val()=='0' || $("#likecar").val()==0){
alert('请选择车型');
return false;
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment