//增加trim函数 String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); } function checkIntNum(Num) { var i,j,strTemp; strTemp = "0123456789"; if ( Num.length == 0) return 0 for (i = 0;i < Num.length; i++) { j = strTemp.indexOf(Num.charAt(i)); if (j == -1) { //说明有字符不是数字 return 0; } } //说明是数字 return 1; } var S_DbUrl=location.pathname; S_DbUrl=S_DbUrl.substring(0,S_DbUrl.toLowerCase().indexOf(".nsf")+4); if(S_DbUrl.charAt(0) != "/") S_DbUrl = "/" + S_DbUrl; S_DbPath=S_DbUrl.substring(0,S_DbUrl.lastIndexOf("/")); S_SetupPath=S_DbPath.substring(0,S_DbPath.lastIndexOf("/")); function orderViewTable() { var i,j; var fieldHide=document.all.F_HideColumn; if(document.all.viewTable) { viewTable.rows[0].cells[0].style.width="0%"; for(j=1;j=0;j--) { viewTable.rows[i].deleteCell(parseInt(arrHide[j])); } } } viewTable.className="TbView"; } } function orderInviewTable() { var i,j; var fieldHide=document.all.F_HideColumn; if(document.all.viewTable) { viewTable.rows[0].cells[0].style.width="0%"; for(j=1;j=0;j--) { viewTable.rows[i].deleteCell(parseInt(arrHide[j])); } } } viewTable.className="TbInview"; } } function trim(str) { for(var i = 0 ; i0 && str.charAt(j-1)==" " ; j--) ; if(i>j) return ""; return str.substring(i,j); } function trimField(strField) { var item = eval("document.all." + strField); item.value = trim(item.value); return item.value; } function getUrlParam(urlstring,paramname) { var tempstr; var i,j; i=urlstring.indexOf(paramname + "="); if(i==-1) return ""; tempstr=urlstring.substring(i); i=tempstr.indexOf("=")+1; j=tempstr.indexOf("&"); if(j==-1) return tempstr.substring(i); return tempstr.substring(i,j); } function isInt(strNum) { var strTmp = strNum; if(strTmp.substring(0,1) == "-") strTmp = strTmp.substring(1); var re = /\D/g; if(re.test(strTmp)) return false; var val=parseInt(strNum,10); if(isNaN(val)) return false; if(arguments[1]!=null) if(valarguments[2]) return false; return true; } function isFloat(strNum) { var strTmp = strNum; if(strTmp.substring(0,1) == "-") strTmp = strTmp.substring(1); var i=strTmp.indexOf("."); if(i!=-1) { var tempstr=strTmp.substring(i+1); var j=tempstr.indexOf("."); if(j!=-1) return false; } var re = /[^\d\.]/g; if(re.test(strTmp)) return false; var val=parseFloat(strNum); if(isNaN(val)) return false; if(arguments[1]!=null) if(valarguments[2]) return false; return true; } function input(strMsg) { var arr=new Array; arr[0]=strMsg; arr[1]=(arguments[1]==null)?"":arguments[1]; var style = "dialogWidth:400px; dialogHeight:140px; status:0;scroll:0; help:0"; return showModalDialog(getDbUrl("..")+"/html/input.htm",arr,style) } function trimArray(src) { var rtn = new Array; for(var i=0;i "; document.write(strHtml); } function showLabel(n) { for(var i=1;i -1) url = url.replace(re,l); else url += l; } location = url; } function closeIE() { top.close(); } function AddressBook(fieldType, fieldName, isMulSelect, selectType, canBeMove, strSep) { var path = getDbUrl("...")+"/sys/lks_sysconfig.nsf/FM_Address?ReadForm&"+(isMulSelect?"Mul":"Sgl"); var style = "dialogWidth:620px; dialogHeight:400px; status:0;scroll:0; help:0; resizable:1"; var typeArr = fieldType.split(':'); var nameArr = fieldName.split(':'); var parameter = new Array; var fieldObj = new Array; if (selectType) parameter[0] = selectType; else parameter[0] = "UPGM"; if (canBeMove) parameter[1] = true; else parameter[1] = false; if (strSep) parameter[2] = strSep; else parameter[2] = ";"; for (var i=0; i3 && infoArr[i].substring(0,3)=="dep"){ finddep = true; continue; } if (infoArr[i]=="post" || infoArr[i]=="dpost") findpost = true; findother = true; } for (i=0; i23 || hourStr<0) || (minuStr>59 || minuStr<0) || (m>2 || n>2)) { alert("请检查您的时间输入是否有误"); fieldname.value = nowTime return false; } return true; } function checkPleonasm(viewName, keyword, docid, casesensitive) { var path=location.href.toLowerCase(); var i; if(!docid){ docid = DocId; if (!docid){ i = path.indexOf("?"); if(i>-1){ docid = path.substring(0, i); docid = docid.substring(docid.lastIndexOf("/")+1); } } } path = path.substring(path, path.indexOf(".nsf")); i = viewName.lastIndexOf("/"); if (i>-1){ var dbpath = viewName.substring(0, i); viewName = viewName.substring(i+1); }else{ var dbpath = path + ".nsf"; } i = dbpath.indexOf("://"); if (i>-1){ dbpath = dbpath.substring(i+3); dbpath = dbpath.substring(dbpath.indexOf("/")+1); } dbpath = dbpath.substring(0,1)=="/"?dbpath.substring(1):dbpath; path = path.substring(0,path.lastIndexOf("/")); path = path.substring(0,path.lastIndexOf("/"))+"/sys/lks_public.nsf/AG_CheckPleonasm?Openagent" path += (casesensitive?"&casesensitive":"")+"&db=" + dbpath + "&view=" + viewName; path += "&class=" + escape(keyword) + "&docid=" + docid; var xml = new ActiveXObject("MSXML.DOMDocument"); xml.async = false; xml.load(path); nodes = xml.selectNodes("ReturnMsg"); return (nodes[0].text=="1"); } function DrawButtom(imgpath,strText,strCode,strId,title) { var Result = ""; var tbwidth = strText.length*20; if(title=="" || title==null) title = strText; Result += ""; Result += ""; Result += ""; Result += ""; Result += ""; return Result; } function showAuthorization(dbPath, idObj, fieldName, EmptyAllRead, mailText, notify) { if (mailText==null) mailText = "\"请查阅文档:\"+Subject"; if (notify==null) notify = true; var path = location.href.toLowerCase(); path = path.substring(path.indexOf("//")+2); path = path.substring(path.indexOf("/"),path.indexOf(".nsf")); if (dbPath==null) dbPath = path.substring(1,path.length) + ".nsf"; path = path.substring(0,path.lastIndexOf("/")); path = path.substring(0,path.lastIndexOf("/")); path += "/sys/lks_public.nsf/fm_authorizeframe?readform&dbpath="+dbPath; var style = "dialogWidth:600px; dialogHeight:280px; status:0;scroll:0; help:0"; var parameter = new Array; var i, tmpArr; if (typeof(idObj)=="string"){ path += "&docid="+idObj; parameter[1] = idObj; }else{ if (idObj==null) idObj = document.forms[0].F_Selected; if (idObj.length==null){ if (idObj.checked) parameter[1] = idObj.value; }else{ for (i=0; i-1) { alert("“"+fieldInfo[1]+"”含有非法字符组合!请重新输入。"); rtnVal = false; } break; case "C": if(fieldObj.value.charAt(fieldObj.value.length-1) == "<") { alert("“"+fieldInfo[1]+"”含有非法字符组合!请重新输入。"); rtnVal = false; break; } if(fieldObj.value.search(/<\w/gi)>-1) { alert("“"+fieldInfo[1]+"”含有非法字符组合!请重新输入。"); rtnVal = false; break; } if(fieldObj.value.search(/[\&+|]/gi)>-1) alert("“"+fieldInfo[1]+"”不能含有\\&+|等特殊符号!请重新输入。"); break; case ",": replaceSymbol(fieldInfo[0],",",",") break; case ";": replaceSymbol(fieldInfo[0],";",";") break; } if (!rtnVal){ try{fieldObj.focus();} catch(err){} return false; } } } return true; } function remind(width,height) { var speed = 2; var WW = 180; var WH = 160; if(width != null) WW = width; if(height != null) WH = height; var SW = screen.availWidth; var SH = screen.availHeight; var WX = SW - WW - 10; var WY = SH; window.focus(); window.resizeTo(WW,WH); window.moveTo(WX,WY); remind_moveup(0,WH / speed,speed); } function remind_moveup(numNow,numMax,speed) { window.moveBy(0,-speed); if(numNow >= numMax) setTimeout("remind_movedown(" + numNow + "," + speed + ")",3000); else setTimeout("remind_moveup(" + (numNow + 1) +"," + numMax + "," + speed + ")",10); } function remind_movedown(numNow,speed) { window.moveBy(0,speed); if(numNow >= 0) setTimeout("remind_movedown(" + (numNow - 1) + "," + speed + ")",10); else window.close(); } function getDbUrl(opt, includeDNS) { var url=includeDNS?location.href:location.pathname; if (opt=="/") return location.href.substring(0,location.href.indexOf(location.pathname)); url=url.substring(0,url.toLowerCase().indexOf(".nsf")+4); if(opt == null) opt = "."; for(var i = 1; i < opt.length; i++) url=url.substring(0,url.lastIndexOf("/")); if(url.charAt(0) != "/" && !includeDNS) url = "/" + url; return url; } function getRadioValue(v) { var object=eval("document.forms[0]."+v); var nlength=object.length; for (var i=0;i-1?tmpArr[0].substring(n+1):tmpArr[0]; break; case "A": for (var j=0; j-1?tmpArr[j].substring(n+1):tmpArr[j]; rtnList[i] = tmpArr.join("/"); break; case "C": if (tmpArr.length>1){ tmpArr[0] = tmpArr[0].indexOf("=")>-1?tmpArr[0]:"CN="+tmpArr[0]; for (var j=1; j-1?tmpArr[j]:"OU="+tmpArr[j]; tmpArr[j] = tmpArr[j].indexOf("=")>-1?tmpArr[j]:"O="+tmpArr[j]; } rtnList[i] = tmpArr.join("/"); } } return nameList[0]?rtnList:rtnList[0]; } function ChangeSelectType(fieldList){ fieldList = fieldList.split(":"); var fieldObj, newObj, i, j; for(i=0; i"; var found = false; for(j=0; j"; setTimeout("document.all."+fieldList[i]+".focus();",0); }else{ newObj = document.createElement(""); newObj.value = fieldObj.options[fieldObj.selectedIndex].text; newObj.chgOption = new Array; for(j=0; j↓"); fieldObj.replaceNode(newObj); } } } function WriteOCXObject(filePath) { filePath = filePath?filePath:getDbUrl(".."); filePath = filePath.substring(filePath.length-1)=="/"?filePath:filePath+"/"; var htmlCode=""; document.write(htmlCode); } function forbidLink() { document.oncontextmenu =function(){if(event.srcElement.tagName == "A") return false;}; } function disableClick() { for(var i=0;i=0) && (strTemp.charCodeAt(i)<=255)) sum = sum + 1; else sum = sum + 2; } return sum; } function checkInputDate(strDate) { var res=false; if (strDate!="") {//has input strTemp = "-0123456789"; for (i = 0;i < strDate.length; i++) { j = strTemp.indexOf(strDate.charAt(i)); if (j == -1) { //说明有字符不是数字 return false; } } var pattern=/\d{4}-\d{2}-\d{2}/; res=pattern.exec(strDate); } return res; } //检查日期是否在一个月内 function checkMDate(str1,str2) { var res = true; //year if(str1.substring(0,7) != str2.substring(0,7)) { res = false; } else if(str1.substring(0,7) < "2005-01") { res = false; } return res; } function checkQuarterDate(str1,str2) { var res = true; //year if(str1.substring(0,4) != str2.substring(0,4)) { return false; } else { if(str2.substring(5,7) <= "03") { if(str1.substring(5,7) > "03") return false; } else if(str2.substring(5,7) <= "06" ) { if(str1.substring(5,7) > "06" || str1.substring(5,7) < "04" ) return false; } else if(str2.substring(5,7) <= "09") { if(str1.substring(5,7) > "09" || str1.substring(5,7) < "07" ) return false; } else if(str2.substring(5,7) <= "12" ) { if (str1.substring(5,7) < "10") return false; } } return res; } function isSpecial(ch) { var special = new Array("\"","'","<",">","\\","`","~"); for(var i = 0; i < special.length; i++) { //alert('ch='+ch+' special[i]='+special[i]); if(ch == special[i]) { return true; } } return false; } //判断字符串中是否含有特殊字符 function hasSpecial(str) { if(str == "") return false; for(var i = 0; i < str.length; i++) { if(isSpecial(str.charAt(i))) { return true; } } return false; } function MM_openBrWindow(theURL,winName) { var iWidth=700; var iHeight=500; var iTop=(window.screen.height-iHeight)/2; var iLeft=(window.screen.width-iWidth)/2; var winobj = window.open(theURL,winName,"Scrollbars=yes,Toolbar=no,Location=no,Direction=no,resizable=yes,Width="+iWidth+",Height="+iHeight+",top="+iTop+",left="+iLeft) return winobj; } function openWindow(theURL,winName) { var iWidth=700; var iHeight=500; var iTop=(window.screen.height-iHeight)/2; var iLeft=(window.screen.width-iWidth)/2; var winobj = window.open(theURL,winName,"Scrollbars=yes,Toolbar=no,Location=no,Direction=no,resizable=yes,Width="+iWidth+",Height="+iHeight+",top="+iTop+",left="+iLeft) return winobj; } function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); }