Example analysis of jquery linkage calendar _jquery

Source: Internet
Author: User

One, to achieve the function:

1. Click on the arrow above, switch to the first one months, or the next one months, and is linked.

2. As long as it is not the actual month, then the date displayed is gray bottom.

Second, analysis:

1. When we click on the arrow to switch the date, change the top blue year and date.

2. When we click on the switch date arrow, the following TD date and the month shown above correspond.

3. With a judge, whether the actual month, to control the background color of TD, whether it is gray

Demo download

Click Update one months ago $ (". Pre"). Live ("Click", Function () {nowtitledatem--; if (Nowtitledatem = =) {nowlastm = nowTitleDateM-1 nexttitledatey--Nexttitledatem = nowtitledate
        M+1 nextlastm = 1}else if (Nowtitledatem = = 0) {nowtitledatey--= 12;
        Nowlastm = nowTitleDateM-1;
        Nexttitledatem = 1;
        Nextlastm = nexttitledatem+1}else if (Nowtitledatem = = 1) {nowlastm = 12;
        Nexttitledatem = nowtitledatem+1 nextlastm = nexttitledatem+1}else{nowlastm = nowTitleDateM-1  
    Nexttitledatem = nowtitledatem+1 nextlastm = nexttitledatem+1}//days and Storage location update ();   
    Insert to the number of the TD among the INSERTTD ();
  Update Date title updatetitle ();
  //Click Next one months $ (". Next"). Live ("Click", Function () {nowtitledatem++; if (Nowtitledatem = =) {nowlastm = nowTitleDateM-1 nexttitledatey++ Nexttitledatem = 1 nextlastm
= Nexttitledatem+1  }else if (Nowtitledatem = =) {nowlastm = nowTitleDateM-1 Nexttitledatem = nowtitledatem+1 nextlastm =
      1}else if (Nowtitledatem = =) {nowtitledatey++ Nowtitledatem = 1;
      Nowlastm = 12;
      Nexttitledatem = nowtitledatem+1;
      Nextlastm = nexttitledatem+1}else if (Nowtitledatem = = 1) {nowlastm = 12; Nexttitledatem = nowtitledatem+1 nextlastm = nexttitledatem+1}else{nowlastm = nowTitleDateM-1 Nextti 
    Tledatem = nowtitledatem+1 nextlastm = nexttitledatem+1}//days and Storage location update ();
    Insert to the number of the TD among the INSERTTD ();
  Update Date title updatetitle (); })

The above is the entire content of this article, I hope to help you, thank you for the support of the cloud habitat community!

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.