function setEvent(target, a, b, opt) {
var arg = [].slice.call(arguments, 1), backup = arg.concat();
$(target).live(opt.eventName, $.extend({}, opt), function (e) {
if ($(target).attr('disabled') == "disabled") { return; }
if (arg.length <= 1) { arg = backup.concat(); }
arg[0].call(this, e);
arg.shift() && opt.callback();
$(target).hasClass('ui_tgb_style' + opt.btnType + '_rever') ? $(target).removeClass('ui_tgb_style' + opt.btnType + '_rever') : $(target).addClass('ui_tgb_style' + opt.btnType + '_rever');
});
}
var arg = [].slice.call(arguments, 1), backup = arg.concat();
$(target).live(opt.eventName, $.extend({}, opt), function (e) {
if ($(target).attr('disabled') == "disabled") { return; }
if (arg.length <= 1) { arg = backup.concat(); }
arg[0].call(this, e);
arg.shift() && opt.callback();
$(target).hasClass('ui_tgb_style' + opt.btnType + '_rever') ? $(target).removeClass('ui_tgb_style' + opt.btnType + '_rever') : $(target).addClass('ui_tgb_style' + opt.btnType + '_rever');
});
}
function setEvent(target, a, b, opt) {
var arg = [].slice.call(arguments, 1), backup = arg.concat();
//事件委托 类型 opt.eventName,参数opt
$(target).live(opt.eventName, $.extend({}, opt), function (e) {
//如果 目标对象 属性disabled='disabled' 不处理
if ($(target).attr('disabled') == "disabled") { return; }
if (arg.length <= 1) { arg = backup.concat(); }
arg[0].call(this, e); // ==> a.call(this,e)
arg.shift() && opt.callback();
//如果有 ui_tgb_styleXXX_rever 样式, 就删除 ui_tgb_styleXXX_rever,
//没有添加 ui_tgb_styleXXX_rever 样式
$(target).hasClass('ui_tgb_style' + opt.btnType + '_rever') ?
$(target).removeClass('ui_tgb_style' + opt.btnType + '_rever') :
$(target).addClass('ui_tgb_style' + opt.btnType + '_rever');
});
}
arg = [].slice.call(arguments, 1) ==> arg =[ a, b, opt]
arg.shift() ==>rg =[ b, opt] ,shift是推出数级的第一个
所以第二次 arg[0] =b 了
arg = [].slice.call(arguments, 1) ==> arg =[ a, b, opt]
arg.shift() ==>rg =[ b, opt] ,shift是推出数级的第一个
所以第二次 arg[0] =b 了
明白了 非常感谢