<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/JavaScript" src="publicJQuery/jquery-2.1.4.js"></script>
<script type="text/JavaScript">
function fn1(hash){
this.name=hash.name;
this.age=hash.age;
this.sex=hash.sex;
document.writeln("fn1函数 姓名:"+this.name+" 年龄:"+this.age+" 性别:"+this.sex+"<br/>");
}
function fn2(hash){
this.xuehao=hash.xuehao;
this.banji=hash.banji;
document.writeln("fn2函数 学号:"+this.xuehao+" 班级:"+this.banji+"<br/>");
}
function fn3(value){
/*如果不是hash对象,而是直接传入value参数的话
document.writeln("fn3函数,参数为value,输出为:"+value+"<br/>");//输出为:[object Object]
*/
//以下是使用hash对象
this.value=value.value;
document.writeln("fn3函数,参数为value,输出为:"+this.value+"<br/>");//输出为:fn3函数,参数为value,输出为:hash对象的value
}
var callbackfn=$.Callbacks();
callbackfn.add(fn1,fn2,fn3);
callbackfn.fire({name:"xq",sex:"男",xuehao:66668888,banji:"tinghua",value:"hash对象的value"});
</script>
</body>
</html>
jquery多个参数以及参数个数不一样的回调函数(使用hash对象)
最新推荐文章于 2025-06-19 14:35:59 发布