ip138js代码:ip138中各种客户端验证js代码来源: 发布时间:星期四, 2009年12月10日 浏览:0次 评论:0
复制代码 代码如下:
function checkIP { var ipArray,ip,j; ip = document.ipform.ip.value; (/[A-Za-z_-]/.test(ip)){ (ip.indexOf(" ")>=0){ ip = ip.replace(/ /g,""); document.ipform.ip.value = ip; } (ip.toLowerCase.indexOf("http://")0){ ip = ip.slice(7); document.ipform.ip.value = ip; } (!/^([\w-]+\.)+((com)|(net)|(org)|(gov\.cn)|(info)|(cc)|(com\.cn)|(net\.cn)|(org\.cn)|(name)|(biz)|(tv)|(cn)|(mobi)|(name)|(sh)|(ac)|(io)|(tw)|(com\.tw)|(hk)|(com\.hk)|(ws)|(travel)|(us)|(tm)|(la)|(me\.uk)|(org\.uk)|(ltd\.uk)|(plc\.uk)|(in)|(eu)|(it)|(jp))$/.test(ip)){ alert("不是正确域名"); document.ipform.ip.focus; false; } } { ipArray = ip.split("."); j = ipArray.length (j!=4) { alert("不是正确IP"); document.ipform.ip.focus; false; } for(var i=0;i<4;i) { (ipArray[i].length0 || ipArray[i]>255) { alert("不是正确IP"); document.ipform.ip.focus; false; } } } } function checkMobile{ var sMobile = document.mobileform.mobile.value (!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(sMobile))){ alert("不是完整11位手机号或者正确手机号前 7位"); document.mobileform.mobile.focus; false; } window.open('', 'mobilewindow', 'height=197,width=350,status=yes,toolbar=no,menubar=no,location=no') } function checkZip{ var sZip = document.zipform.zip.value (!(/^\d{4,6}$/.test(sZip))){ alert("请输入邮政编码前4-6位"); false; } window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes') } function checkZone{ var sZone = document.zoneform.zone.value (!(/^0\d{2,6}$/.test(sZone))){ alert("请输入以“0”开头3-7位区号"); false; } window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes') } function checkArea2Zip{ var sArea = document.area2zipForm.area.value (sArea""){ alert("请输入地址"); document.area2zipForm.area.focus; false; } (sArea.length<2){ alert("地址至少要有2个字"); document.area2zipForm.area.focus; false; } window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes') } function checkArea2Zone{ var sArea = document.area2zoneForm.area.value (sArea""){ alert("请输入地址"); document.area2zoneForm.area.focus; false; } (sArea.length<2){ alert("地址至少要有2个字"); document.area2zoneForm.area.focus; false; } window.open('','searchwindow','height=197,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes') } function checkID{ var sID = document.IDform.userid.value (!(/^\d{15}$|^\d{18}$|^\d{17}[xX]$/.test(sID))){ alert("请输入15位或18位身份证号"); document.IDform.userid.focus; false; } } //--> </script> 0
相关文章读者评论发表评论 |
|