Compatibility is not considered for another calendar input effect.

Source: Internet
Author: User


[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
It is too urgent to consider compatibility.
It is implemented through two classes: Panel class and calendar class.
Since all public js files are loaded at one time in the top-level window during development, you must upload the current window object when creating the object in the subwindow, for example, var panel = new parent. parent. selectPanel (self); If the self parameter is not passed, the js window is loaded by default.

The Gregorian algorithm marcian found on the Internet is a bit complicated. I obtain the maximum number of days in the current month, and the number of days in the week on the first day of the current month is directly implemented through the Date function provided by JS.
Copy codeThe Code is as follows:
// Obtain the maximum number of days in a month
// Asfman provides a simpler method: return (new Date (y, m + 1, 0). getDate ()
Function GetDates (year, month)
{
Var date = new Date (year, month, 31 );
Return 31-date. getDate () | 31;
}
// Obtain the day of the week on the first day of the month.
Function GetFirstDay (year, month)
{
Return (new Date (year, month, 1). getDay ();
}

/* The following part can be ignored, because even if new Date (2007,-1, 31) occurs, the Date will be automatically converted to Date (2006, 12, 31)
If (month <0)
{
Month = 11;
Year --;
}
If (month = 12)
{
Month = 0;
Year ++;
}*/

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.