/** * Function: To load the date of the current two years into * $ (' #year ') years Select id = year * $ (' #month ') year SELECT id = month * $ (' #date ') year SELECT id = Date * At the same time to determine how many days of the month, such as non-leap year February only 28th * * Ready is a method of running after loading if this method is used directly for the distribution of the object; * The Extend method is that the extension method class must be added in the form of class function () {} * The method in which the class is invoked can use this directly; * Event defaults to blur can change its trigger action; * Complete is the code that ends up being run; * * This method is mainly not applied in the validation and the selection of synchronous mutation **/ var dyear = $ (' #year '). Dform ({ ' Ready ': function () { This.resetyear (); }, ' Extend ': function () { This.resetyear = function () { This.cleanoptions (); var now = new Date (); n class= "keyword" >for (var i = now.getfullyear (); I < Now.getfullyear () + 2; i + +) this.addoptions (i); } }, ' Event ': ' Change ', ' Complete ': function () { Dmonth.resetmonth (); Ddate.resetdate (); } }) var dmonth = $ (' #month '). Dform ({ ' Ready ': function () { This.resetmonth (); }, ' Extend ': function () { This.resetmonth = function () { var month = This.val (); This.cleanoptions (); for (var i = 1; i < i + +) this.addoptions (i, I < 10?) ' 0 ' + i:i); This.val (month); } }, ' Event ': ' Change ', ' Complete ': function () { Ddate.resetdate (); } }) var ddate = $ (' #date '). Dform ({ ' Ready ': function () { This.resetdate (); }, ' Extend ': function () { This.resetdate = function () { var date = This.val (); This.cleanoptions (); var maxdate = new Dform (). Getdaysinmonth (parseint (Dyear.val ()), parseint (Dmonth.val ())); for (var i = 1; i < maxdate + 1; i + +) this.addoptions (i, I < 10?) ' 0 ' + i:i); This.val (date); } } }) These three are interrelated 3-level associations I do is year-by-day five-level association and cannot exceed the current time. This three-level association is easier to understand. What if I'm going to use Ajax to do it without having to use Jquery.ajax ({}) to commit and process it? This also takes into account the use of Ajax in the inside and is exactly the same as the $.ajax ({}) method in jquery /** function * Mainly verify is not the email address; * Simultaneously request the server to see whether the mailbox address is occupied * * $ (' #email ') input text id = Email * Method Detection methods are custom methods that can be added with extend (function () {}) * or the Dformet method of JS file added * Run before before operation * Wait waiting for run in the main for Ajax when running * Error errors are run * Success Run correctly * Complete at the end of the run, whether right or wrong; */ var demail = $ (' #email '). Dform ({ ' Allerror ': false, ' method ': ' Isemail ', ' Ajax ': { ' type ': ' Post ', ' DataType ': ' JSON ', ' URL ': ' ajax.php ' }, ' Before ': function () { $ (' #emailR '). Val (' Beforefunc '); }, ' Wait ': function () { $ (' #emailR '). Val (' Waitfunc '); }, ' Error ': function (res) { $ (' #emailR '). Val (' ERROR: ' + res); }, & nbsp ' Success ': function (res) { $ (' #emailR '). Val (' success: ' + res); }, ' Complete ': function (res) { $ (' #emailR '). Val (' Complete: ' + res); } }); In addition, the method can be used to manipulate the numerical value directly. Dform (). Empty (")//" whether or not "; Dform (). Noempty (")//" is not "; Dform (). Equal (' 123 ', ' 321 ')//' 123′ is ' 123′ Dform (). Equal ($ (' #pw '), $ (' #pw2])//$ (' #pw ') is equal to $ (' #pw2 ') Dform (). Noequal ($ (' #pw '), $ (' #pw2) ')//$ (' #pw ') is not equal to $ (' #pw2 ') Dform (). Noequal (' 123 ', ' 321 ')//321 is not equal to 123 Dform () min (122, 321)//321 is not less than 123 (this is the number of the judge string also line) Dform () Max (122, 321)//321 is not greater than 123 (IBID.) Dform (). Length (3, ' 123 ', ' > ')//' 123′ characters are > 3 Dform (). Length (13, ' Test first Q ', ' >= ', ' All ', ' utf8′,/[^u4e00-ufa29]/g,/[u4e00-ufa29]/g ') Dform (). Preg (/[u4e00-ufa29]/g, ' excuse me ')//Regular Dform (). Minchlength (3, ' ask ') whether the character length is not less than 3 Dform (). Maxchlength (3, ' ask ') whether the character length is not greater than 3 Dform (). Minenlength (3, ' qweq ')//English character length is not less than 3 Dform (). Maxenlength (3, ' qweq ')//English string degree is not greater than 3 Dform (). MinLength (10, ' Weapon Q ')//character length is not less than 10 Dform (). MinLength (9, ' weapons Q ', ' All ', ' utf8′,/[^u4e00-ufa29]/g,/[u4e00-ufa29]/g ') Dform (). MaxLength (9, ' weapons Q ', ' All ', ' utf8′,/[^u4e00-ufa29]/g,/[u4e00-ufa29]/g ') Dform (). Minchorenlength (4, 7, ' ask Qwe ')//character length is not greater than 10 Dform (). Minchorenlength (3, 6, ' Ask Qwe ', ' utf8′,/[^u4e00-ufa29]/g,/[u4e00-ufa29]/g) Dform (). Maxchorenlength (3, 6, ' Ask Qwe ', ' utf8′,/[^u4e00-ufa29]/g,/[u4e00-ufa29]/g) Dform (). Hasen (' Ask Wqe ') whether it contains English letters excluding punctuation figures Dform () Hasch (' Ask Wqe ') whether it contains Chinese punctuation, including Chinese Dform (). Nohasen (' qwe ')/whether does not contain Dform (). Nohasch (' qwe ')/whether does not contain Dform () Hasennoch (' qwe ')/Whether only Chinese is not English Dform (). Haschnoen (' qwe ')/whether only English is not Chinese Dform () Haschanden (' ask ') whether there is Chinese and Chinese Dform (). Isemail (' qowera@qq.com ')/Whether it is a mailbox Dform (). Isemail (' qowera@qq.com ', true)/whether the mailbox will verify the error results of the mailbox all output; Dform (). ISPASSW Ord (' 123qwe7890!@#$%67 ')/whether is the password can fill true ditto Dform (). Isname (' ox ')/Whether the name is customized specifically for must only Chinese or English can not be less than 2 Chinese characters can not be more than 10 characters in English can not be less than 2 English characters can not be more than 10 English characters Dform (). Isname (' 123 ', true)//on the same Dform (). Touppermoney (' en ', ' 11231223.132 ')//money converted to thousands separated by commas Dform (). Touppermoney (' ch ', ' 11231223.132 ')//money into Chinese form; Whether the Dform (). Iseffectivenum (' 23 ')//is a valid number; Publish all of the attributes a little bit to change a bit better not to change; var options = { ' Trigger ': null,//trigger; ' target ': null,//object; ' Allerror ': true,//return all results all/single; ' Cache ': true,//cache; ' Language ': ' en ',//EN, ch; ' CharSet ': ' utf8′,//UTF8, GBK; ' tag ': ' Input ',//target's tag; ' Type ': ' Text ',//target type; ' response ': {},//set resonse initial value; ' value ': null,//Set initial value; ' typeset ': New Array (' > ', ' < ', ' >= ', ' <= ', ' = = '), ' CharSet ': New Array (' utf8′, ' GBK '), ' Languageset ': New Array (' en ', ' ch ', ' all '), ' Pregset ': { ' Enchar ':/[^u4e00-ufa29]/, ' Chchar ':/[u4e00-ufa29]/, ' En ':/^[a-za-z]+$/, ' ch ':/^[u4e00-ufa29]+$/, ' num ':/[0-9]+/, ' Effectivenum ':/^ ([1-9][0-9]* (.)? [0-9]+|0 (.) [0-9]+| [1-9] [0-9]*[0-9]*) $/ }, ' Upper ': { ' num ': New Array (' 0 ', ' one ', ' II ', ' three ', ' Restaurant ', ' Wu ', ' land ', ' qi ', ' ba ', ' nine '), ' unitadvanced ': New Array (' Circle ', ' million ', ' billion ', ' trillion ', ' Jing ', ' Gai ', ' 秭 ', ' rang ', ' ditch ', ' brook ', ' right ', ' load ', ' pole ', ' Ganges ', ' Monk? ', ' that by him ', ' inconceivable ', ' Immeasurable ', ' large number '), ' Unitlow ': New Array (' Thousand ', ' Bai ', ' pick ', '), ' Unitdecimal ': New Array (' Angle ', ' min ', ', ') }, ' Line ': New Array (//Operation sequential; ' Method ', ' selected ', ' Empty ', ' noempty ', ' equal ', ' noequal ', ' min ', ' Max ', ' between ', ' Minlen ', ' maxlen ', ' minenorchlength ', ' Maxenorchle Ngth ', ' minenlength ', ' maxenlength ', ' minchlength ', ' maxchlength ', ' IsEn ', ' Isch ', ' isnum ', ' iseffectivenum ', ' Isenchar ', ' Nohasenchar ', ' nohasnum ', ' Nohasenchar ', ' Nohaschchar ', ' Hasenchar ', ' Haschchar ', ' hasnum ', ' Preg ', ' Ajax ' ), ' Package ': New Array (),//encapsulation of good methods; ' method ': null,//detection methods; ' selected ': null,//choice; ' Empty ': null,//Must be empty; ' Noempty ': null,//cannot be empty; ' equal ': null,//must equal; ' noequal ': null,//cannot equal; ' min ': null,//must be greater than or equal to (number); ' Max ': null,//must be less than or equal to (number); ' Between ': null,//must be greater than or equal to and less than equal; ' Minlen ': null,//character length must be greater than or equal; ' MaxLen ': null,//character length must be less than or equal; ' minenorchlength ': null,//English must be greater than or equal to or Chinese must be greater than or equal to; ' maxenorchlength ': null,//English must be less than or equal to or Chinese must be less than equal; ' minenlength ': null,//English must be greater than or equal to; ' maxenlength ': null,//English must be less than or equal; ' minchlength ': null,//Chinese must be greater than or equal to; ' maxchlength ': null,//Chinese must be less than equal; ' isEn ': null,//Must be English; ' Isch ': null,//Must be Chinese; ' Isnum ': null,//must be a number; ' Iseffectivenum ': null,//must be a valid number; ' Isenchar ': null,//must be English character; ' Ischchar ': null,//Must be Chinese character; ' Nohasenchar ': null,//must not contain English characters; ' Nohaschchar ': null,//must not contain Chinese characters; ' Nohasnum ': null, Must not contain a number (string); ' Hasenchar ': null,//must contain English characters; ' Haschchar ': null,//must contain Chinese characters; ' Hasnum ': null,//must contain a number (string); ' Preg ': null,//testing is in compliance; ' Ajax ': null,//trigger AJAX request; ' Ready ': null,//initialized to run after Func; ' Extend ': null,//extension method class; ' Event ': ' Blur ',//triggers the elements of the event; ' Before ': function () {},//Pre func triggered ' Wait ': function () {},//Waiting func is mainly used for Ajax wait; ' Error ': function () {},//Trigger error Func ' Success ': function () {},//Trigger success Func ' Complete ': function () {}//Trigger complete Func } |