FunctionIsEmail (str) {varr ^ [a-zA-Z0-9 _ %-] + @ [a-zA-Z0-9-] + [a-zA-Z] {2, 4} $; if (rtest (str )) {returntrue;} else {retu
Function IsEmail (str) {var r =/^ [a-zA-Z0-9. _ %-] + @ [a-zA-Z0-9. -] + \. [a-zA-Z] {2, 4} $/; if (r. test (str) {return true;} else {return false;} function IsTel (str) {var s =/^ (\ d {2, 4 }) (-(\ d {7, 8}) $/; if (s. test (str) {return true;} else {return false;} function IsMobile (str) {var regu =/^ [1] [3, 5, 8] [0-9] {9} $/; var re = new RegExp (regu); if (re. test (str) {return true;} else {return false;} f Unction IsDecimal (str) {if (str = "") {return false;} if (/^ \-? ([1-9] \ d *) | \ d) (\. \ d {1, 4 })? $ /). Test (str) {return true;} else {return false ;}} function IsInt (str) {if (str = "") {return false ;} if (str = "0") {return false;} var type = "^ [0-9] * [1-9] [0-9] * $ "; var re = new RegExp (type); if (str. match (re) = null) {return false;} else {return true;} function isChinaOrNumbOrLett (s) {// determine whether the component is a var regu = "^ [0-9a-zA-Z \ u4e00-\ u9fa5] + $"; var re = new RegExp (regu ); if (re. t Est (s) {return true;} else {return false;} function LTrim (str) {return str. replace (/^ [\ t \ n \ r] +/g, "");} function RTrim (str) {return str. replace (/[\ t \ n \ r] + $/g, "");} function Trim (str) {return RTrim (LTrim (str ));} /*************** converts the input letters into uppercase letters. ** ************/Function input_to_uppercase (obj) {obj. value = obj. value. toUpperCase ();}/**************** convert the input letter to lowercase. ** ************/Function input_to_lowercase (obj) {obj. value = obj. value. toLowerCase ();}/**************** Real-Time Detection of the number of words in the input boxMaximum text length: 20. Remaining: 20.* ************/Function check_input_Length (which) {var maxChars = 20; if (which. value. length> maxChars) which. value = which. value. substring (0, maxChars); var curr = maxChars-which. value. length; document. getElementById ("chLeft "). innerHTML = curr. toString ();} // convert the date to "yyyymmdd" format. The second parameter is the return type, which is 'ym': yyyy-mm, 'md': mm-dd, the default value is 'yyyy-mm-dd' function ConvertDateFormatString (strDate, sye) {if (strDate = null | StrDate = "" | strDate = "0" | strDate. length <8) {return ("");} else {try {var ExDate = new Date (strDate. replace (/^ (\ d {4}) (\ d {2}) (\ d {2}) $ /, "$1/$2/$3"); var yyyy = ExDate. getFullYear (); var mm = ExDate. getMonth () + 1; mm = mm <10? "0" + mm: mm; var dd = ExDate. getDate (); dd = dd <10? "0" + dd: dd; switch (sye) {case "ym": return yyyy + "-" + mm; break; case "md ": return mm + "-" + dd; break; default: return yyyy + "-" + mm + "-" + dd; break ;}} catch (e) {return ("") }}/ **************** set and obtain CookieCookie. write ("Michael", "xxxxaaxaaa"); alert (Cookie. read ("James"); ***************/var Cookie = {} Cookie. write = function (key, value) {var d = new Date (); d. setTime (d. getTime () + 1000 * 60*60*24*30); document. cookie = key + "=" + encodeURI (value) + "; expires =" + d. toGMTString () ;}; Cookie. read = function (key) {var arr = document. cookie. match (new RegExp ("(^ |)" + key + "= ([^;] *) (; | $)"); if (arr! = Null) return decodeURIComponent (arr [2]); return "" ;}; // easyUI confirm function Confirm (msg, control) {$. messager. confirm ("OK", msg, function (r) {if (r) {return true ;}); return false ;}// gridview bindfunction gridview (objgridview) {// get obj id var gridviewId = "#" + objgridview; // even $ (gridviewId + "> tbody tr: even "). addClass ("NormalColor"); // first $ (gridviewId + "> tbody tr: first "). remov EClass ("NormalColor "). addClass ("HeadColor"); // odd $ (gridviewId + "> tbody tr: odd "). addClass ("AlterColor"); // move and click $ (gridviewId + "> tbody tr "). slice (1 ). hover (function () {$ (this ). addClass ("HoverColor") ;}, function () {$ (this ). removeClass ("HoverColor") ;}); // all check $ ("# chkAll "). click (function () {$ (gridviewId + '> tbody> tr> td> input: checkbox '). attr ('checked', this. checked );});// Check status $ (gridviewId + '> tbody> tr> td> input: checkbox '). click (function () {var expr1 = gridviewId + '> tbody> tr> td> input: checkbox: checked '; var expr2 = gridviewId + '> tbody> tr> td> input: checkbox'; var selectAll = $(expr1 ). length = $(expr2 ). length; $ ('# chkall '). attr ('checked', selectAll) ;}// show easyUI loadfunction Load () {$ (").css ({display:" block ", width: & quot; 100% & quot;, height: $ (w Indow). height ()}). appendTo ("body"); $ ("Running .html (" running, please wait... "). AppendTo ("body" ).css ({display: "block", left: ($ (document. body ). outerWidth (true)-190)/2, top: ($ (window ). height ()-45)/2});} // display easyUI Loadfunction dispalyLoad () {$ (". datagrid-mask "). remove (); $ (". datagrid-mask-msg "). remove ();} // show loadingfunction showLoad (tipInfo) {var eTip = document. createElement ('div '); eTip. setAttribute ('id', 'tipdiv '); eTip. style. position = 'absolute '; e Tip. style. display = 'none'; eTip. style. border = 'solid 0px # D1D1D1 '; eTip. style. backgroundColor = '# 4B981D'; eTip. style. padding = '5px 15px '; eTip. style. top = '10px '; eTip. style. right = '10px '; eTip. style. width = '120px '; eTip. innerHTML = ''+ tipInfo +''; try {document. body. appendChild (eTip);} catch (e) {}$ ("# tipDiv" ).css ("float", "right "); $ ("# tipDiv" ).css ("z-index", "99"); $ ('# tipDiv '). fa DeIn ();} // display loadingfunction closeLoad () {$ ('# tipDiv '). fadeOut ();} // open JqueryDialogfunction showMyModalDialog (url, width, height, Title) {var now = new Date (); var urlr if (url. indexOf ('=') =-1) {urlr = url + "? Cach = "+ escape (now);} else {urlr = url +" & cach = "+ escape (now);} // add zjc if (Title! = Null) {JqueryDialog. open (Title, urlr, width, height);} else {JqueryDialog. open ('', urlr, width, height) ;}// close JqueryDialogfunction DialogCloseReload (url, info) {alert (info); window. parent. location. href = url; window. parent. jqueryDialog. close () ;}// confirm dialog // if (ConfirmDialog ('Are you sure you want to delete the data? ') {Alert ('start delete');} function ConfirmDialog (info) {if (confirm (info) {return true;} else {return false ;}} /*** ajax post submit * @ param url * @ param datat: html, json, text * @ param callback function * @ return */function jsonAjax (url, param, datat, callback) {$. ajax ({type: "post", url: url, data: param, dataType: datat, success: callback, error: function () {jQuery. fn. mBox ({message: 'recovery failed'}) ;}}) ;}/ * check alertcheckAlert (IsEmail ($ ("# txtEmail "). val (), 'Enter the correct email address '); */function checkAlert (fn, info) {if (fn = false) {alert (info ); return ;}}/* check alert disabledcheckAlert (IsEmail ($ ("# txtEmail "). val (), 'Enter the correct email address ', 'btnsubmit'); */function checkAlert (fn, info, objId) {if (fn = false) {alert (info); $ ("#" + objId ). attr ("disabled", true); return false;} else {$ ("#" + objId ). attr ("disabled", false); return true ;}/ * check to messagevar str = ""; str ++ = checkString (IsEmail ($ ("# txtEmail "). val (), 'Enter the correct email address '); str + = checkString (IsMobile ($ ("# txtMobile "). val (), 'Enter the correct phone number'); */function checkString (fn, info) {if (fn = false) {return info + "\ n" ;}else {return "";}}