Easyui Datebox only Choose the month

Source: Internet
Author: User

Title, to the Internet or to find a good big burst of the solution to a predecessor, but there is a bit of bug, fixed here posted out, hoping to help more small partners!

 $ (' #dlgReleaseTime '). Datebox ({                onshowpanel:function () {//Display The event that the month layer is not generated when the object is increasingly selected and the month layer is not created at initialization                     Span.trigger (' click ‘); Trigger Click event Popup Month layer                     if (!tds)                         setTimeout (function () {//Delay trigger gets month object because the event trigger above and object generation have time interval   &N Bsp                        /tds = P.find (' div.calendar-menu-month- Inner TD ');                          Tds.click (fun) Ction (e) {                                E.stoppropagation (); Disable bubbling execution Easyui events for month                                 var year =/\d{4}/.exec (span.html ()) [0]//Get years                 &NBSP ;                  month = parseint ($ (this). attr (' abbr '), ten);Monthbefore this is the month = parseint ($ (this). attr (' abbr '), + 1;                              $ (' #dlgRel Easetime '). Datebox (' Hidepanel ')//Hidden Date object                       &NBSP ;             Datebox (' SetValue ', year + '-' + month '); Set Date value                            ; })                      }, 0);            &NB Sp  },                Parser:function (s) {//config parser, return selected date     &NB Sp               if (!s) return new Date ();            &NBSP ;       var arr = s.split ('-');                    return n EW Date (parseint (arr[0), parseint (Arr[1], 10) -1, 1);               },                 formatter:function (d) {returnd.getfullyear () + '-' + (D.getmonth () +1);}//configuration formatter, only return monthbefore this is the d.getfullyear () + '-' + (D.getmonth ());}); var p = $ (' #dlgReleaseTime '). Datebox (' panel '),//Date Select object TDS = False,//Date Selection object in month span = P.find (' Span.calendar-text '); Displays the trigger control for the month layer var curr_time = new Date (), $ ("#dlgReleaseTime"). Datebox ("SetValue", MyFormatter (Curr_time));//Set the month before// Formatted date
function MyFormatter (date) {var y = date.getfullyear ();  var m = date.getmonth () + 1;  var d = 1; Return y + '-' + (M < 10?) (' 0 ' + m): m);//+ '-' + (D < 10? (' 0 ' + D): D);}

<input id= "Dlgreleasetime" class= "Easyui-datebox" ></input> earlier if you choose December will become "2015-0", solve a problem, getmonth function from 0月-November! There's a problem with that solution before!

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.