国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Regex > 正文

ip138中各種客戶端驗證js代碼

2020-03-16 21:14:24
字體:
供稿:網(wǎng)友
包括ip驗證,身份證驗證,手機(jī)號碼驗證,電話號碼,郵政編碼驗證,域名驗證等,其實好的代碼,都在應(yīng)用中,大家多去扒代碼吧。
 
 

 

復(fù)制代碼代碼如下:

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;i<4;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位手機(jī)號或者正確的手機(jī)號前七位"); 
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位區(qū)號"); 
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.length<2){ 
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.length<2){ 
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> 

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 南召县| 恭城| 康保县| 虹口区| 北碚区| 新乐市| 新巴尔虎左旗| 华池县| 濉溪县| 辛集市| 凤城市| 昆山市| 凌云县| 织金县| 阿拉善左旗| 吉木乃县| 保德县| 彰武县| 布尔津县| 陇西县| 灌南县| 慈溪市| 阿合奇县| 绥江县| 永州市| 娄烦县| 弥渡县| 龙海市| 西乡县| 九台市| 百色市| 安宁市| 河北区| 巢湖市| 孟津县| 兴化市| 河东区| 报价| 永川市| 荥阳市| 邢台县|