Div-like select-based time interaction (JQ perfectly compatible Version)

Source: Internet
Author: User

Previously, JS written in native mode, but labels cannot be used. Therefore, IE7 cannot support the current layout of the JQ version. The class name is exactly the same as the previous one. It is only the JQ method.

Function year_select () {// year var stryyyy = hour (); var strmm = hour ('.ulmon'{.eq(0}.html (); var strdd = hour ('.ulday'{.html (); var yearxs = $ (". year. XS "). eq (0); var monxs = $ (". month. monxs "). eq (0); var monhead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31]; var y = new date (). getfullyear (); $ ('. DIAN '). eq (0 ). click (function () {yearclick () ;}); yearxs. click (function () {yearclick ();}); Function yearclick () {var uldiv = $ (". quan "). eq (0); uldiv. show (); // var STR = stryyyy. substring (0, stryyyy. length-5); var STR = ""; for (VAR I = (y-50); I <(Y + 1); I ++) // subject to this year, previous 1 year, next 50 years {STR + = "<li value = '" + I + "'>" + I + "</LI> ";} certificate ('.ulyear'0000.eq(0).html (STR); $ ('. ulyear '). eq (0 ). find ('lil '). click (function () {yearxs.html(((this).html (); yearxs. ATTR ("value", $ (this ). ATTR ("value"); yyyymm ($ (This ). ATTR ("value"); setdata (); uldiv. hide () ;}) ;}// month $ ('. month. dianmon '). eq (0 ). click (function () {moonclick () ;}) monxs. click (function () {moonclick ();}) function moonclick () {$ (". quanmon "). eq (0 ). show (); var STR = ""; for (VAR I = 1; I <13; I ++) {STR + = "<li value = '" + I + "'>" + I + "</LI>" ;}('.ulmon'{.eq(0).html (STR); $ ('. ulmon '). eq (0 ). find ("Li "). click (function () {monxs.html ($ (this ). HTML () monxs. ATTR ("value", $ (this ). ATTR ("value"); $ (". quanmon "). eq (0 ). hide (); setdata (); mmdd ($ (this ). ATTR ("value")});} var n = monhead [new date (). getmonth ()]; If (new date (). getmonth () = 1 & ispinyear (yyyyvalue) n ++; $ (". dianday "). click (function () {dayclick () ;}) $ (". dayxs "). click (function () {dayclick ();}) function dayclick () {var yearxs = $ (". year. XS "). eq (0); var yearvlaue = yearxs. ATTR ("Va Lue "); var monvalue = monxs. ATTR ("value"); If (yearvlaue = NULL | monvalue = NULL) {return ;}$ (". quanday "). show (); // display in the drop-down window} function writeday (n) // drop-down box of the conditional write date {var S = strdd; For (VAR I = 1; I <(n + 1); I ++) S + = "<li value = '" + I + "'>" + I + "</LI> "; $ (". ulday "2.16.html (s); // var Lis = $ (". ulday "). find ("Li"); $ (". ulday "). find ("Li "). click (function () {detail ('.dayxs'{.html({(this}.html (); $ ('. dayxs '). ATT R ("value", $ (this ). ATTR ("value"); setdata (); $ ('. quanday '). hide () ;}) ;}function yyyymm (STR) // The date when the year changes (mainly to determine the year of the week) {var mmstr =$ (". month. monxs "2.16.html () if (mmstr = NULL | mmstr =" ") {return;} else {mmstr = parseint (mmstr. tostring (), 10);} var n = monhead [mmstr-1]; If (mmstr = 2 & ispinyear (STR) n ++; writeday (n);} function mmdd (STR) // Date linkage when the month changes {var yyyystr = $ (". year. XS "2.16.eq(02.16.html (); I F (yyyystr = NULL | yyyystr = "") {return;} else {yyyystr = parseint (yyyystr. tostring (), 10);} If (STR = NULL) {return;} STR = parseint (STR, 10); var n = monhead [str-1]; if (STR = 2 & ispinyear (yyyystr) n ++; writeday (n);} function ispinyear (year) // determine whether to renew the year {return (0 = year % 4 & (Year % 100! = 0 | year % 400 = 0)} function setdata () {var year = parseint ($ (". year. XS "). eq (0 ). ATTR ("value"), 10); var MON = parseint ($ (". month. monxs "). eq (0 ). ATTR ("value"), 10); var day = parseint ($ (". day. dayxs "). ATTR ("value"), 10); $ ("input [name = 'birthday']"). val (Year + "-" + MON + "-" + day) ;};/** admission date **/function year2_select () {// year var stryyyy = Week (); var strmm = week ('.ulmon'{.eq(1}.html (); var strdd = {('.ulday'{.html (); var yearxs = $ (". year. XS "). eq (1); var monxs = $ (". month. monxs "). eq (1); var monhead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31]; var y = new date (). getfullyear (); $ ('. DIAN '). eq (1 ). click (function () {yearclick () ;}); yearxs. click (function () {yearclick () ;}); function yearclick () {$ (". quan "). eq (1 ). show (); // var STR = stryyyy. substring (0, stryyyy. length-5); var STR = ""; for (VAR I = (y-50); I <(Y + 1); I ++) // subject to this year, previous 1 year, next 50 years {STR + = "<li value = '" + I + "'>" + I + "</LI> ";} certificate ('.ulyear'0000.eq(1).html (STR); $ ('. ulyear '). eq (1 ). find ('lil '). click (function () {yearxs.html(((this).html (); yearxs. ATTR ("value", $ (this ). ATTR ("value"); $ (". quan "). eq (1 ). hide (); setdata () ;}}// month $ ('. month. dianmon '). eq (1 ). click (function () {moonclick () ;}) monxs. click (function () {moonclick ();}) function moonclick () {$ (". quanmon "). eq (1 ). show (); var STR = ""; for (VAR I = 1; I <13; I ++) {STR + = "<li value = '" + I + "'>" + I + "</LI>" ;}('.ulmon'{.eq(1).html (STR); $ ('. ulmon '). eq (1 ). find ("Li "). click (function () {monxs.html({this}.html () monxs. ATTR ("value", $ (this ). ATTR ("value"); $ (". quanmon "). eq (1 ). hide (); setdata () ;}) ;}function setdata () {var year = parseint ($ (". year. XS "). eq (1 ). ATTR ("value"), 10); var MON = parseint ($ (". month. monxs "). eq (1 ). ATTR ("value"), 10); $ ("input [name = 'ugrad']"). val (Year + "-" + MON );}};

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.