手机和电话的验证
$(".btn input[type='submit']").click(function(){ var company=$("#company").val().replace("/\s+/g",""); var contact=$("#contact").val().replace("/\s+/g",""); var tel=$("#tel").val().replace("/\s+/g",""); var pattern = /(^0{0,1}1[3|4|5|6|7|8|9][0-9]{9}$)/; var phone= /^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/; if(company==""|| contact=="" || tel==""){ $(".btn span.red").html("单位,联系人和电话必须填写"); }else if(!(pattern.exec(tel)||phone.test(tel))){ $(".btn span.red").html("您输入的电话号码有误,座机号区号之间请用-分割"); }else{ $(".btn span.red").html(""); } })
补充:web前端 , HTML/CSS ,