6、结合类 6.1 email的判断。 function ismail(mail) { return(new RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(mail)); } 6.2 手机号码的验证 6.3 身份证的验证 function isIdCardNo(num) { if (isNaN(num)) {alert("输入的不是数字!"); return false;} var len = num.length, re; if (len == 15) re = new RegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{3})$/); else if (len == 18) re = new RegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\d)$/); else {alert("输入的数字位数不对!"); return false;} var a = num.match(re); if (a != null) { if (len==15) { var D = new Date("19"+a[3]+"/"+a[4]+"/"+a[5]); var B = D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5]; } else { var D = new Date(a[3]+"/"+a[4]+"/"+a[5]); var B = D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5]; } if (!B) {alert("输入的身份证号 "+ a[0] +" 里出生日期不对!"); return false;} } return true; }
3.7 复选框的全选,多选,全不选,反选
全选
全选
2.验证IP地址
function isip(s){ var check=function(v){try{return (v<=255 && v>=0)}catch(x){return false}}; var re=s.split(".") return (re.length==4)?(check(re[0]) && check(re[1]) && check(re[2]) && check(re[3])):false }
var s="202.197.78.129"; alert(isip(s)) 《SCRIPT》
3.加sp1后还能用的无边框窗口!!
/*--- Special Thanks For andot ---*/
/* This following code are designed and writen by Windy_sk You can use it freely, but u must held all the copyright items! */
/*--- Thanks For andot Again ---*/
var CW_width = 400; var CW_height = 300; var CW_top = 100; var CW_left = 100; var CW_url = "/"; var New_CW = window.createPopup(); var CW_Body = New_CW.document.body; var cOntent= ""; var CSStext = "margin:1px;color:black; border:2px outset;border-style:expression(Onmouseout=Onmouseup=function(){this.style.borderStyle=&#39;outset&#39;}, Onmousedown=function(){if(event.button!=2)this.style.borderStyle=&#39;inset&#39;});background-color:buttonface;width:16px;height:14px;font-size:12px;line-height:11px;cursor:Default;";