birthday.js 1.1 KB

1
  1. (function(c){c.extend({ms_DatePicker:function(a){function h(){if(0==d.val()||0==e.val())f.html(g);else{f.html(g);var a=parseInt(d.val()),b=0;switch(parseInt(e.val())){case 1:case 3:case 5:case 7:case 8:case 10:case 12:b=31;break;case 4:case 6:case 9:case 11:b=30;break;case 2:if(b=28,0==a%4&&0!=a%100||0==a%400)b=29}for(var a=f.attr("rel"),c=1;c<=b;c++)f.append('\x3coption value\x3d"'+c+'" '+(a==c?"selected":"")+"\x3e"+c+"\x3c/option\x3e")}}a=c.extend({},{YearSelector:"#sel_year",MonthSelector:"#sel_month",DaySelector:"#sel_day",FirstText:"\u8bf7\u9009\u62e9",FirstValue:""},a);var d=c(a.YearSelector),e=c(a.MonthSelector),f=c(a.DaySelector),g='\x3coption value\x3d"'+a.FirstValue+'"\x3e'+a.FirstText+"\x3c/option\x3e";d.html(g);e.html(g);f.html(g);var b=(new Date).getFullYear()+5;for(a=d.attr("rel");2010<=b;b--){var k=a==b?"selected":"";d.append('\x3coption value\x3d"'+b+'" '+k+"\x3e"+b+"\x3c/option\x3e")}a=e.attr("rel");for(b=1;12>=b;b++)k=a==b?"selected":"",e.append('\x3coption value\x3d"'+b+'" '+k+"\x3e"+b+"\x3c/option\x3e");e.change(function(){h()});d.change(function(){h()});""!=f.attr("rel")&&h()}})})(jQuery);