日期:2014-05-16 浏览次数:20477 次
//打开弹出窗口 function winOpen (strURL,strName,width,height) { theWindow = window.open (strURL,strName,"width="+width+" height="+height+" scrollbars=yes left="+(1024-width)/2+" top="+(768-height)/2); if (theWindow.opener == null) theWindow.opener = window; if (window.focus) theWindow.focus(); } //验证邮件 function verifyEmailAddress(strEmail){ var myReg = /^[_a-zA-Z0-9_-_._-]+@([_a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,3}$/; return myReg.test(strEmail); } /***************************************************************** **** 判断是否为日期数据 (lhm) 例子:itIsDate("2009-10-7" , "-") ***** *****************************************************************/ function itIsDate(DateString , Dilimeter) { if (DateString==null) return false; if (Dilimeter=='' || Dilimeter==null) Dilimeter = '-'; var tempy=''; var tempm=''; var tempd=''; var tempArray; if (DateString.length<8 && DateString.length>10) return false; tempArray = DateString.split(Dilimeter); if (tempArray.length!=3) return false; if (tempArray[0].length==4) { tempy = tempArray[0]; tempd = tempArray[2]; } else { tempy = tempArray[2]; tempd = tempArray[1]; } tempm = tempArray[1]; var tDateString = tempy + '/'+tempm + '/'+tempd+' 8:0:0';//加八小时是因为我们处于东八区 var tempDate = new Date(tDateString); if (isNaN(tempDate)) return false; if (((tempDate.getUTCFullYear()).toString()==tempy) && (tempDate.getMonth()==parseInt(tempm)-1) && (tempDate.getDate()==parseInt(tempd))) { return true; } else { return false; } } /***************************************************************** **** 求字符串的字节长度 (lhm) ***** *****************************************************************/ function byteLength(paraString) { var strValue =new String(paraString); var strLength = strValue.length; var numLength =0; for (globle_i =0 ; globle_i<strLength;globle_i++){ var ASCIIValue =strValue.charCodeAt(globle_i); if ( ASCIIValue > 0 && ASCIIValue < 127 ) numLength = numLength + 1 else numLength = numLength + 2 } return numLength; } /***************************************************************** **** 去除空格 (lhm) ***** *****************************************************************/ function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } function ltrim(stringToTrim) { return stringToTrim.replace(/^\s+/,""); } function rtrim(stringToTrim) { return stringToTrim.replace(/\s+$/,""); } String.prototype.trim = function() {return this.replace(/^\s+|\s+$/g,"");} String.prototype.ltrim = function() {return this.replace(/^\s+/,"");} String.prototype.rtrim = function() {return this.replace(/\s+$/,"");} /***************************************************************** **** 复选框的全选与取消 (LHM) ***** *****************************************************************/ function CheckAll(form){ var length = form.itemId.length; var tocheck = form.chkall.checked; if (length) for (var i=0; i<length; i++){ if (form.itemId[i].disabled != true){ form.itemId[i].checked = tocheck; } } else { if (form.itemId.disabled !=true){ form.itemId.checked = tocheck; } } } /***************************************************************** **** 删除处理 (LHM) ***** *****************************************************************/ function del_btn (form,strMsg,actionurl){ var result = false; var length = form.itemId.length; if (form.itemId.checked) { //只有一条记录时执行此语句 result = true; } for (var i=0; i<length; i++){ if (form.itemId[i].checked){ result = true; break; } } if (!result){ alert ("没有选择任何项目!"); return false; }e