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