shminyff
2015-05-28 16:24
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://img.mukewang.com/down/540812440001e40e00000000.js" type="text/javascript"></script>
<title></title>
</head>
<body>
<script type="text/javascript">
function show(data) {
$("body").append('<li>' + data + '</li>')
}
function fn1(value) {
show("fn1 says: "+value+'</br>');
}
function fn2(value) {
fn1("fn2 says: " + value+'</br>');
return false;
}
function fn3(value) {
fn1("fn3 says: " + value+'</br>');
return false;
}
var callbacks = $.Callbacks();
callbacks.add(fn1);
callbacks.fire("foo!"); //输出fn1 says:foo!
callbacks.add(fn2);
callbacks.fire("too!"); //输出 fn1 says:too! fn1 says:fn2 says:too!
callbacks.add(fn3);
callbacks.fire("bar!"); //输出fn1 says:bar! fn1 says:fn2 says:bar! fn1 says:fn3 says:bar!
</script>
</body>
</html>
sorry,各位,是我自己把方法调用写错了,浪费大家时间,非常抱歉
jQuery源码解析(架构与依赖模块)
84047 学习 · 280 问题
相似问题