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

首頁 > 編程 > JavaScript > 正文

JS代碼判斷集錦大全第1/5頁

2019-11-21 01:51:21
字體:
來源:轉載
供稿:網友

具體代碼如下所示:

<script language="JavaScript"> function checkid(iden,year,month,day){ if (iden.value.length==15) { if ((iden.value.lastIndexOf(month.value+day.value))==8) { return true; } return false; } if (iden.value.length==18) { if ((iden.value.indexOf(year.value+month.value+day.value))==6) { return true; } return false; } return false; } function isCharsInBag (s, bag) { var i; for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (bag.indexOf(c) == -1) return false; } return true; } function isEmpty(s) { return ((s == null) || (s.length == 0)) } function isWhitespace (s) { var whitespace = " /t/n/r"; var i; for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (whitespace.indexOf(c) >= 0) { return true; } } return false; } function isEmail (s,t) { if (isEmpty(s)) { window.alert("輸入的E-mail地址不能為空,請輸入!"); mobj = eval(t); mobj.focus(); mobj.select(); return false } if (isWhitespace(s)) { window.alert("輸入的E-mail地址中不能包含空格符,請重新輸入!"); mobj = eval(t) mobj.focus() mobj.select() return false; } var i = 1; var len = s.length; if (len > 50) { window.alert("email地址長度不能超過50位!"); mobj = eval(t) mobj.focus() mobj.select() return false; } pos1 = s.indexOf("@"); pos2 = s.indexOf("."); pos3 = s.lastIndexOf("@"); pos4 = s.lastIndexOf("."); if ((pos1 <= 0)||(pos1 == len)||(pos2 <= 0)||(pos2 == len)) { window.alert("請輸入有效的E-mail地址!"); mobj = eval(t) mobj.focus() mobj.select() return false; } else { if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1) || ( pos1 != pos3 ) || ( pos4 < pos3 ) ) { window.alert("請輸入有效的E-mail地址!"); mobj = eval(t) mobj.focus() mobj.select() return false; } } if ( !isCharsInBag( s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@")) { window.alert("email地址中只能包含字符ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@/n" + "請重新輸入" ); mobj = eval(t) mobj.focus() return false; } return true; } function isnumber(str){ var digits="1234567890"; var i=0; var strlen=str.length; while((i<strlen)){ var char=str.charAt(i); if(digits.indexOf(char)==-1)return false;i++; } return true; } function isnumbercode(str){ var digits="1234567890-/"; var i=0; var strlen=str.length; while((i<strlen)){ var char=str.charAt(i); if(digits.indexOf(char)==-1)return false;i++; } return true; } </script> <script language=javascript> function checkForm(theform){ if (document.frm.companyname.value.length==0){ alert("單位名稱不能為空。"); mobj = eval("document.frm.companyname"); mobj.focus() mobj.select() return false; } if (document.frm.address.value.length==0){ alert("單位地址不能為空"); mobj = eval("document.frm.address"); mobj.focus() mobj.select() return false; } if (document.frm.invest.value.length==0){ alert("投資額不能為空"); mobj = eval("document.frm.invest"); mobj.focus() mobj.select() return false; } if (document.frm.codeornumber.value.length==0){ alert("法人代碼證書號或營業執照編號不能為空"); mobj = eval("document.frm.codeornumber"); mobj.focus() mobj.select() return false; } if (document.frm.linkman.value.length==0){ alert("聯系人不能為空"); mobj = eval("document.frm.linkman"); mobj.focus() mobj.select() return false; } if (document.frm.linkmanjob.value.length==0){ alert("聯系人職位不能為空"); mobj = eval("document.frm.linkmanjob"); mobj.focus() mobj.select() return false; } if (document.frm.phone.value.length==0){ alert("電話不能為空"); mobj = eval("document.frm.phone"); mobj.focus() mobj.select() return false; } if (document.frm.email.value=='') { window.alert ("請輸入您的E-mail地址 !") mobj = eval("document.frm.email"); mobj.focus() mobj.select() return false } if ( !isEmail(document.frm.email.value,document.frm.email) ) return false if (document.frm.introduction.value.length==0){ alert("公司簡介不能為空"); mobj = eval("document.frm.introduction"); mobj.focus() mobj.select() return false; } if (document.frm.positionname.value.length==0){ alert("職位名稱不能為空"); mobj = eval("document.frm.positionname"); mobj.focus() mobj.select() return false; } if (document.frm.jobaddress.value.length==0){ alert("工作地點不能為空"); mobj = eval("document.frm.jobaddress"); mobj.focus() mobj.select() return false; } if (document.frm.jobfunction.value.length==0){ alert("工作職責不能為空"); mobj = eval("document.frm.jobfunction"); mobj.focus() mobj.select() return false; } if (document.frm.positionrequre.value.length==0){ alert("職位要求不能為空"); mobj = eval("document.frm.positionrequre"); mobj.focus() mobj.select() return false; } if (document.frm.salary.value.length==0){ alert("待遇不能為空"); mobj = eval("document.frm.salary"); mobj.focus() mobj.select() return false; } } </script> JS代碼判斷集錦(之二)                                                 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 资中县| 房山区| 思南县| 长阳| 建平县| 沭阳县| 会宁县| 宁乡县| 修水县| 米脂县| 鄂尔多斯市| 梁平县| 芷江| 施甸县| 建阳市| 阳曲县| 永年县| 博湖县| 洛扎县| 桐庐县| 南部县| 鄄城县| 全南县| 页游| 全州县| 盐山县| 宜昌市| 武山县| 甘孜县| 勐海县| 宝鸡市| 都江堰市| 汽车| 锡林浩特市| 南昌县| 静安区| 梧州市| 荆州市| 加查县| 溆浦县| 枣强县|