<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="app/js/jquery-2.1.4.js"></script> <script type="text/javascript"> $(function() { var a=11; function aaa(a) { console.log(a); a=10; } function bbb(a) { console.log(a); a=100; } function ccc(a) { console.log(a); a=1000; } // var arry = []; arry.push(aaa); arry.push(bbb); arry.push(ccc); for(var i = 0; i < arry.length; i++) { arry[i](a); } //var sb = $.Callbacks().add(aaa).add(bbb).add(ccc).fire(); var sb = $.Callbacks().add(aaa, bbb ,ccc).fire(a); }) </script> </head> <body> </body> </html>
原文:http://www.cnblogs.com/libin-1/p/6012186.html