/* * Contains jquery-1.3.2.min. js */ document.write(""); /* * Public parameters */ var hostUrl='http://' window.location.host; //Get the website host header /* * Horizontally centered left value */ function HorCenter(x){ return (document.documentElement.clientWidth-x)/2; } /* * Vertically centered top value */ function VerCenter(y){ return (document.documentElement.clientHeight-y)/2 document.documentElement.scrollTop; } /* * Remove the spaces at the left and right ends */ function Trim(str){ return str.replace(/(^s*)|(s*$)/g, ""); } /* * Determine the email address and return true/false */ function IsEmail(email){ var Expression=/w ([- .']w )*@w ([-.]w )*.w([-.]w )*/; var objExp=new RegExp(Expression); return objExp.test(email); } /* * Determine the user name and return true/false */ function IsUser(user){ var Expression=/^(?!_)(?!.*?_$)(w|[u4E00- u9FA5])*$/; //Only numbers, Chinese characters, letters, and underscores can be combined, and underscores cannot be at the beginning or end var objExp=new RegExp(Expression); return objExp.test(user); } /* * Determine the mobile phone number */ function IsMobile(mobile){ var Expression=/^1[3458]{1}[0-9]{ 9}$/; var objExp=new RegExp(Expression); return objExp.test(mobile); } /* * Judge non-negative integer and return true/false */ function IsInt(intval){ var Expression=/^d $/; var objExp=new RegExp(Expression); return objExp.test(intval); } /* * Judge the number and return true/false */ function IsNum(num){ return !isNaN(num); } /* * Determine RMB (money) and return true/false */ function IsMoney(money){ var Expression=/^(([1-9]d |0). d{2}|([1-9]d |0))$/; var objExp=new RegExp(Expression); return objExp.test(money); } / * * Calculate the length of the string, Chinese numbers are recorded as two, English numbers are recorded as one */ function GetByteLen(sChars){ return sChars.replace(/[^x00-xff] /g,"xx").length; } /* * Limit the longest input string */ function GetByteVal(sSource, iLen){ if (sSource.replace(/[^x00-xff]/g,"xx").length<=iLen) { return sSource; } else { var str=""; var l=0; var schar; for(var i=0;schar=sSource.charAt(i);i ) { str = schar; l =(schar.match(/[^x00-xff]/) != null ? 2:1); if(l>=iLen) { break; } } return str; } } /* * Write cookie */ function SetCookie(name,value) { var argv=SetCookie.arguments; var argc=SetCookie.arguments.length; var expires=(2var path=( 3var domain=(4var secure=(5document.cookie=name "=" escape(value) ((expires==null)?"":("; expires=" expires.toGMTString())) ((path==null)?"": ("; path=" path)) ((domain==null)?"":("; domain=" domain)) ((secure==true)?"; secure":""); } /* * Get cookie */ function GetCookie(name){ var search = name "="; var returnvalue = ""; if ( document.cookie.length > 0) { offset = document.cookie.indexOf(search); if (offset != -1) { offset = search.length ; end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document. cookie.substring(offset,end)); } } return returnvalue; } /* * checkBox select all, clear all * * Quote * * */ function CheckAll(obj,objForm){ if(obj.checked==true){ $('#' objForm ' input:checkbox.chk').each(function(){ this.checked='checked'; }); } else{ $('#' objForm ' input:checkbox.chk').each(function(){ this.checked=''; }); } } /* * Support Copy for multiple browsers */ function CopyValue(strValue){ if(IsIE()) { clipboardData.setData("Text",strValue); alert("Copy successfully"); } else { Copy(strValue); alert("Copy successfully"); } } /* * Determine IE browser */ function IsIE(number){ if(typeof(number)!=number) { return!!document.all ; } }
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn