本地验证代码如下,然后这个大神在用谷歌浏览器,在下方可能是操作台上面输入了一个document{}form{}submit 我没看清的这句代码,我不知道他在哪里用的,我想请问大神有懂的么?代码大概是这样的
var postmaxchars = 50; |
| function lphychknum(strnumber) |
| { |
| lphypar=/^\d{1,6}(\.\d{1,4})?$/ |
| return lphypar.test(strnumber); |
| } |
| function lphychktel(strnumber) |
| { |
| lphypar=/^(\d){2,4}([-]{0,1})(\d){5,9}(,(\d){2,4}([-]{0,1})(\d){5,9})*$/; |
| return lphypar.test(strnumber); |
| } |
| function checkradio(lphyobj) { |
| var i; |
| for(i=0;i<lphyobj.length;i++){ |
| if(lphyobj.checked){ |
| return true; |
| } |
| }; |
| return false; |
| } |
| |
| function validate(theform) { |
| if (theform.housearea.options[theform.housearea.selectedIndex].value==0 || theform.housearea.options[theform.housearea.selectedIndex].value=="") { |
| alert("请选择区域!"); |
| return false; |
| } else if (theform.housemodel.options[theform.housemodel.selectedIndex].value==0 || theform.housemodel.options[theform.housemodel.selectedIndex].value=="") { |
| alert("请选择户型!"); |
| return false; |
| } else if (!checkradio(theform.housetype)) { |
| alert("请选择房屋类型!"); |
| return false; |
| } else if (!checkradio(theform.fitment)) { |
| alert("请选择装修程度!"); |
| return false; |
| } else if (theform.houseaddr.value == "" || theform.buildarea.value == "" || theform.buyprice.value == "" || theform.linkman.value == "" || theform.telephone.value == "") { |
| alert("房产位置、房屋面积、价格、联系人及联系电话不能为空!"); |
| return false; |
| } else if (theform.houseaddr.value.length > 30 ) { |
| alert("房产位置太长!"); |
| return false; |
| } else if (theform.housename.value.length > 30 ) { |
| alert("小区名称太长!"); |
| return false; |
| } else if (lphytitlechk(theform.houseaddr.value)) { |
| alert("房产位置不能包含特殊字符!"); |
| return false; |
| } else if (!lphychknum(theform.buildarea.value)||!lphychknum(theform.buyprice.value)) { |
| alert("房屋面积和价格只能为数字且小数位数不超过4位!"); |
| return false; |
| } else if (theform.buildarea.value.length > 8 || theform.buyprice.value.length > 8) { |
| alert("房屋面积或价格太长!"); |
| return false; |
| } else if (theform.linkman.value.length > 18) { |
| alert("联系人太长!"); |
| return false; |
| } else if (theform.telephone.value.length > 30) { |
| alert("联系电话太长!"); |
| return false; |
| } else if (!lphychktel(theform.telephone.value)) { |
| alert("电话号码格式不对,多个号码请用英文逗号隔开!"); |
| return false; |
| } else if (theform.linkaddr.value.length > 30) { |
| alert("其他联系方式太长!"); |
| return false; |
| } |
| if (theform.housenum) |
| { |
| if (theform.housenum.value.length > 18 ) { |
| alert("房源编号太长!"); |
| return false; |
| } |
| } |
| if (postmaxchars != 0 && theform.otherequip.value.length > postmaxchars) { |
| alert("其他说明太长!\n\n当前长度: "+theform.otherequip.value.length+" 字节\n系统要求:小于 "+postmaxchars+" 字节"); |
| return false; |
| } |
| theform.topicsubmit.disabled = true; |
| return true; |
| } |
| function lphyaddmap(){ |
| var lphyhtml='<br><iframe frameborder="0" scrolling="no" width="510px" height="342px" src="map/add_map.htm" class="top10"></iframe>'; |
| if(document.getElementById('lphymapdiv').innerHTML=='') |
| { |
| document.getElementById('lphymapdiv').innerHTML=lphyhtml; |
| }else{ |
| document.getElementById('lphymapdiv').innerHTML=''; |
| } |
| } |