首页前端开发其他前端知识ip138中各种客户端验证js代码

ip138中各种客户端验证js代码

时间2024-02-01 15:40:02发布访客分类其他前端知识浏览638
导读:收集整理的这篇文章主要介绍了ip138中各种客户端验证js代码,觉得挺不错的,现在分享给大家,也给大家做个参考。 复制代码 代码如下:function checkIP( { VAR i...
收集整理的这篇文章主要介绍了ip138中各种客户端验证js代码,觉得挺不错的,现在分享给大家,也给大家做个参考。

复制代码 代码如下:
function checkIP()
{
VAR ipArray,ip,j;
ip = document.ipform.ip.value;

if(/[A-Za-z_-]/.test(ip)){
if (ip.indexOf(" ")> =0){
ip = ip.replace(/ /g,"");
document.ipform.ip.value = ip;
}
if (ip.toLowerCase().indexOf("http://")==0){
ip = ip.slice(7);
document.ipform.ip.value = ip;
}
if(!/^([\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();
return false;
}
}
else{
ipArray = ip.split(".");
j = ipArray.length
if(j!=4)
{
alert("不是正确的IP");
document.ipform.ip.focus();
return false;
}

for(var i=0; i4; i++)
{
if(ipArray[i].length==0 || ipArray[i]> 255)
{
alert("不是正确的IP");
document.ipform.ip.focus();
return false;
}
}
}
}

function checkmobile(){
var sMobile = document.mobileform.mobile.value
if(!(/^1[3|4|5|8][0-9]\d{ 4,8} $/.test(sMobile))){
alert("不是完整的11位手机号或者正确的手机号前七位");
document.mobileform.mobile.focus();
return false;
}
window.oPEn('', 'mobilewindow', 'height=197,width=350,status=yes,toolbar=no,menubar=no,location=no')
}

function checkZip(){
var sZip = document.zipform.zip.value
if(!(/^\d{ 4,6} $/.test(sZip))){
alert("请输入邮政编码前4-6位");
return 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
if(!(/^0\d{ 2,6} $/.test(sZone))){
alert("请输入以“0”开头的3-7位区号");
return 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
if(sArea==""){
alert("请输入地址");
document.area2zipForm.area.focus();
return false;
}
if(sArea.length2){
alert("地址至少要有2个字");
document.area2zipForm.area.focus();
return 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
if(sArea==""){
alert("请输入地址");
document.area2zoneForm.area.focus();
return false;
}
if(sArea.length2){
alert("地址至少要有2个字");
document.area2zoneForm.area.focus();
return 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
if(!(/^\d{ 15} $|^\d{ 18} $|^\d{ 17} [xX]$/.test(sID))){
alert("请输入15位或18位身份证号");
document.IDform.userid.focus();
return false;
}
}
//-->
/script>

您可能感兴趣的文章:
  • js在客户端验证密码强度,兼容FireFox和IE
  • javascript 客户端验证上传图片的大小(兼容IE和火狐)
  • jquery 表单进行客户端验证demo
  • fileupload控件 文件类型客户端验证实现代码
  • JAVASCRIPT 客户端验证数据的合法性代码(正则)
  • 使用jQuery.Validate进行客户端验证(初级篇) 不使用微软验证控件的理由
  • JavaScript通过RegExp实现客户端验证处理程序
  • php实现的数字验证码及数字运算验证码
  • js代码验证手机号码和电话号码是否合法
  • 详解ASP.NET七大身份验证方式以及解决方案
  • ASP.NET中验证控件的使用方法
  • Asp.Mvc 2.0实现用户注册实例讲解(1)
  • ASP.NET验证码(3种)
  • javascript表单验证大全
  • Asp.Mvc 2.0用户客户端验证实例讲解(3)

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!

上一篇: Javascript 字符串字节长度计算函...下一篇:javascript 手机号码正则表达式验...猜你在找的正则表达式相关文章 去除内容中的html2022-04-16Python正则表达式保姆式教学详细教程2022-04-16十分钟上手正则表达式 上篇2022-04-16十分钟上手正则表达式 下篇2022-04-16深入浅出正则表达式中的边界\b和\B2022-04-16轻松入门正则表达式之非贪婪匹配篇详解2022-04-16轻松掌握正则表达式findall函数详解2022-04-16正则表达式用法详解2022-04-1636个正则表达式(开发效率提高80%)2022-04-16Python正则表达式指南 推荐2022-04-16 其他相关热搜词更多phpjavapython程序员loadpost-format-gallery

若转载请注明出处: ip138中各种客户端验证js代码
本文地址: https://pptw.com/jishu/595592.html
JS 正则表达式的位置匹配 JavaScript 正则表达式之RegExp属性、方法及应用分析

游客 回复需填写必要信息