首页 > js 函数动态调用问题

js 函数动态调用问题

var mp = {}
mp.add = function(){};
mp.edit = function(){};
// ...还有很多方法

$( '.action a' ).live( 'click', function () {
   var method = $( this ).attr( 'class' ); // 这里获得的method 对应上面的方法
   //mp.method( $( this ), $( this ).parents( 'tr.upload-item' ) );
   //这里怎么根据method 来运行上面的方法呢
});

Good,好样的 谢谢。


mp[method]();
【热门文章】
【热门文章】