月份控件
function yearMoth(id){
var buttons = $.extend([], $.fn.datebox.defaults.buttons);
buttons.splice(1, 0, {
text: '清空',
handler : function(target) {
$(target).combo("setValue", "").combo("setText", ""); // 设置空值
$(target).combo("hidePanel"); // 点击清空按钮之后关闭日期选择面板
}
});
//$.fn.datebox.defaults.buttons = buttons;
$(id).datebox({
buttons: buttons
});
$(id).datebox({
onShowPanel : function() {// 显示日趋选择对象后再触发弹出月份层的事件,初始化时没有生成月份层
span.trigger("click"); // 触发click事件弹出月份层
if (!tds)
setTimeout(function() {// 延时触发获取月份对象,因为上面的事件触发和对象生成有时间间隔
tds = p.find('div.calendar-menu-month-inner td');
tds.click(function(e) {
e.stopPropagation(); // 禁止冒泡执行easyui给月份绑定的事件
var year = /\d{4}/.exec(span.html())[0]// 得到年份
, month = parseInt($(this).attr('abbr'), 1