表单判断手机号 姓名 地区
- 作者:流年视觉 -表单判断手机号 姓名 地区
html:
<form id="wfform"onsubmit="return toVaild()" name="wfform" method="post" class="wfform layui-form" target="_top" action="http://sqz6.sdkadq85014.cn/plus/diy.php" enctype="multipart/form-data" >
js:
<script>
function toVaild(){
if (/=(&|$)/.test($('#wfform').serialize())) {
alert("请将信息填写完整");
return false;
}else{
return true;
}
}
</script>
-------------------
全:
-------------------
全:
<!DOCTYPE html><html><head><title>个人注册</title><meta charset="utf-8"><script src="__JK__/js/phone.js"></script><script src="__JK__/js/jquery.min.js"></script><link href="__JK__/css/index.css" rel="stylesheet" type="text/css"/></head><body><div style="width:100%;height:50px;"></div><h2 style="width:750px;text-align:center;">请填写个人信息</h2><div style="width:700px;margin:0 auto;"><form action="{:url('index/index/gerenzhuce')}" method="post" id="zhuce"><div class="iptbox"><div style="height:80px;line-height:80px;">姓名:</div><div><input type="" name="gr_xingming" value="{$info.gr_xingming}" placeholder="请输入姓名" class="ipt1" ></div></div><div class="iptbox"><div style="height:80px;line-height:80px;">电话:</div><div><input type="" name="gr_tel" value="{$info.gr_tel}" placeholder="请输入电话" class="ipt1" ></div></div><div class="iptbox"><div style="height:80px;line-height:80px;">职业:</div><div><input type="" name="gr_zhiye" value="{$info.gr_zhiye}" placeholder="请输入职业" class="ipt1" ></div></div><div class="iptbox"><div style="height:80px;line-height:80px;">身份证号:</div><div><input type="" name="gr_shenfenzheng" value="{$info.gr_shenfenzheng}" placeholder="请输入身份证号" class="ipt1" ></div></div><div class="checkbox"><div><input name="" type="checkbox" value="" id="xieyi" /></div><div style="height:80px;line-height:80px;color:#666;">我同意<a href="{:url('index/index/xieyi')}" style="color:#ff0000;">"协会协议"</a></div></div></div><input type="" class="btn1" value="确认提交" onclick='check()' /></form><script type="text/javascript">function check(){var gr_xingming = $('input[name="gr_xingming"]').val();if(gr_xingming == null || gr_xingming == ''){alert("姓名不能为空");return false;}var gr_tel = $('input[name="gr_tel"]').val();var re = /^1\d{10}$/;if (!re.test(gr_tel)) {alert("请输入正确手机号码!");return false;}var gr_zhiye = $('input[name="gr_zhiye"]').val();if(gr_zhiye == null || gr_zhiye == ''){alert("职业不能为空");return false;}var gr_shenfenzheng = $('input[name="gr_shenfenzheng"]').val();if(gr_shenfenzheng == null || gr_shenfenzheng == ''){alert("身份证不能为空");return false;}if($("#xieyi").is(':checked') == false){alert("请确认同意协会协议");return false;}$("#zhuce").submit();}</script></body></html>---------------------