/*** @ Class formoperation form operation method collection class * @ constructor */function formoperation () {var tip_class_name = "Tip-messages"; // The message display box var tip_show_time = 5000; // display the time in the message box/*** check required field * @ Param {string} classname class name * @ Param {Boolean} showtip whether a prompt box is displayed, by default, true * @ returns {Boolean} is returned. If not, false */This is returned. requiredfield = function (classname, showtip) {var RF, rfcur; If (showtip = undefined) showtip = true; if ($ (". "+ Classname ). length <1) return true; Rf = $ (". "+ classname); For (VAR I = 0; I <Rf. length; I ++) {rfcur =$ (RF [I]); if ($. trim (rfcur. val () = "" | $. trim (rfcur. val () = rfcur. ATTR ("Placeholder") {If (showtip) {This. showtip (rfcur, tip_class_name, false, 0);} rfcur. focus (); Return false ;}} return true ;}/ *** compare field value * @ Param {string} classname class name * @ Param {Boolean} showtip whether a prompt box is displayed, the default value is true * @ returns {Boolean }. False: returns true */This. comparefield = function (classname, showtip) {var CF, cfcur, curval; If (showtip = undefined) showtip = true; if ($ (". "+ classname ). length <1) return true; cf = $ (". "+ classname); For (VAR I = 0, Len = cf. length; I <Len; I ++) {cfcur =$ (CF [I]); If (I = 0) & (curval = cfcur. val (); If (curval! = Cfcur. val () {If (showtip) {This. showtip (cfcur, tip_class_name, false, 1);} cfcur. focus (); Return false ;}} return true ;}/ *** special field detection * @ Param {string} classname class name * @ Param {string} specialtype special field type, currently, the optional types are: email/Email * @ Param {Boolean}. Whether a prompt box is displayed for showtip. The default value is true * @ returns {Boolean}, and the return value is true. If no, returns false */This. specialfield = function (classname, specialtype, showtip) {var SF, sfval, reg; If (showtip = und Efined) showtip = true; if ($ (". "+ classname ). length <1) return true; Sf = $ (". "+ classname); sfval = $. trim (SF. val (); If (specialtype = "email") {Reg =/^ \ W + (-\ W +) | (\. \ W +) * \ @ {1} \ W + \. {1} \ W {2, 4 }(\. {0, 1} \ W {2}) {0, 1}/ig; If (sfval. search (REG) ===- 1) {If (showtip) {This. showtip (SF, tip_class_name, false, 1);} SF. focus (); Return false ;}} return true ;}/ *** range field match * @ Param {string} classname class name * @ Param {string} sp Ecialtype special field type. Currently, the optional types include: email/Email * @ Param {Boolean}. Whether to display the prompt box. The default value is true * @ returns {Boolean}. True is returned. If no, returns false */This. scopefield = function (classname, showtip, minnumber, maxnumber) {var SF, sfval; If (showtip = undefined) showtip = true; if ($ (". "+ classname ). length <1) return true; Sf = $ (". "+ classname); If (minnumber = undefined) minnumber = 0; If (maxnumber = undefined) maxnumber = 1000000000000; sfval = $. Trim (SF. val (); If (minnumber <= sfval. length & sfval. length <= maxnumber) {return true;} else {If (showtip) {This. showtip (SF, tip_class_name, false, 1);} SF. focus (); Return false ;}} /*** generate a prompt box * @ Param {object} OBJ the element object in the prompt box to be displayed * @ Param {string} tipclassname indicates whether the box name * @ Param {Boolean} autohide is automatically hidden, the default value is true * @ Param {number} msgtype. 1/special message | 2/other messages. The default value is 1 * @ returns {* | jquery | htmlelement, return the prompt box object */ This. showtip = function (OBJ, tipclassname, autohide, msgtype) {var py, PX, ow, MSG, msgindex; If (autohide === undefined) & (autohide = true); If (OBJ) {py = obj. position (). top; PX = obj. position (). left; ow = obj. outerwidth (); // alert (PY + "" + px); $ (". "+ tipclassname ). text (this. gettipmsg (OBJ, "formdata", msgtype1_0000.css ({top: py + 4 + "PX", left: px + ow + "PX "}). show (); If (autohide) {setTimeout (function () {$ (". "+ tipclassna Me ). hide () ;}, tip_show_time) ;}else {return $ (". "+ tipclassname) ;}}/ *** extract the message * @ Param {object} OBJ: The Source attribute name of the message to be extracted from the message * @ Param {string} objattr, default formdata * @ Param {number} msgtype message Category 0/regular message | 1/special message default 0 * @ returns {string | *} Target message */This. gettipmsg = function (OBJ, objattr, msgtype) {var MSG, msglength, msgindex; If (OBJ = undefined) return; If (objattr = undefined) objattr = "formdata"; if (msgtype = UNDEF INED) msgtype = 0; MSG = $. trim ($ (OBJ ). ATTR (objattr); msgindex = msglength = MSG. length; If (MSG. indexof ("&")! =-1) & (msgindex = MSG. indexof ("&"); Switch (msgtype) {Case 0: MSG = MSG. substr (0, msgindex); break; Case 1: MSG = MSG. substr (msgindex + 1, msglength); break;} return MSG;}/*** text box text echo (only for browsers that do not support the "Placeholder" attribute) * @ Param {string} classname text box class name * @ Param {string} replacecolorclassname text color replacement class name */This. echo = function (classname, replacecolorclassname) {var echoobj, echotext, echocur; If (! ('Holder' in document. createelement ('input') {If (! (Echoobj = $ (". "+ classname) return; $. each (echoobj, function (I, OBJ) {$ (OBJ ). val ($ (OBJ ). ATTR ("Placeholder ")). addclass (replacecolorclassname) ;}); echoobj. focus (function () {echocur = $ (this); echotext = echocur. removeclass (replacecolorclassname ). ATTR ("Placeholder"); if ($. trim (echocur. val () = echotext & echocur. val (""));}). focusout (function () {If ($. trim (echocur. val () = "" | $. trim (echocur. val () = echotext) & echocur. val (echotext ). addclass (replacecolorclassname ));});}}}