Easyui Datebox only Choose the month

Source: Internet
Author: User

A function method that turns the date input box into a month
var month=0;
$ (' #effectiveDate '). Datebox ({
Onshowpanel:function () {//displays an event that pops up the month layer after the object is being selected and does not generate a month layer during initialization
Span.trigger (' click '); Trigger the Click event Popup Month Layer
if (!TDS) setTimeout (function () {//delay trigger Gets the month object because the event trigger above and the object generation have a time interval
TDS = P.find (' Div.calendar-menu-month-inner TD ');
Tds.click (function (e) {
E.stoppropagation (); Suppress bubbling execution of Easyui to month-bound events
var year =/\d{4}/.exec (span.html ()) [0]//gets years
, month = parseint ($ (this). attr (' abbr '), 10) + 1; Month
Console.log (month);
Alert (month);
$ (' #effectiveDate '). Datebox (' Hidepanel ')//Hide Date Object
. Datebox (' SetValue ', year + '-' + month); Set the value of a date
});
}, 0);
},
Parser:function (s) {//config parser, returns the selected date
if (!s) return new Date ();
var arr = s.split ('-');
Month=parseint (Arr[1], 10);
Monthstr=month==13?month-1:month;
var newdate=new Date (parseint (arr[0], ten) + "/" +monthstr+ "/01");
return newdate;
},
Formatter:function (d) {
var f=d.getfullyear () + '-' + d.getmonth ();
if (month==13) {
F=d.getfullyear () + '-' + (D.getmonth () +1);
}
return F;

}//configuration formatter, only return month
});
var p = $ (' #starDate '). Datebox (' panel '),//Date Selection Object
TDS = False,//Date Select object in month
span = P.find (' Span.calendar-text '); Display the trigger control for the month layer

Easyui Datebox only Choose the month

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.