jQuery中模拟句柄
jQuery获得函数内的参数:
- $().ready(function() {
- $("#div").css( {
- "border" : "1px solid red",
- "height" : "300px"
- });
- var fn = function() {
- alert(arguments[0].data.uname);
- };
- (function() {
- $("#div").bind("click", {
- "uname" : "zhangsan"
- }, fn);
- })();
- })
- var fn = function() {
- alert(this.prarm);
- };
- var obj = this;
- obj.prarm = 50;
- (function (){
- $("#div").bind("click",{"uname":"zhangsan","this":obj},function(){
- fn.call(arguments[0].data["this"],arguments[0]);
- });
- })();
相关推荐
IT之家 2020-03-11
graseed 2020-10-28
zbkyumlei 2020-10-12
SXIAOYI 2020-09-16
jinhao 2020-09-07
impress 2020-08-26
liuqipao 2020-07-07
淡风wisdon大大 2020-06-06
yoohsummer 2020-06-01
chenjia00 2020-05-29
baike 2020-05-19
扭来不叫牛奶 2020-05-08
hxmilyy 2020-05-11
黎豆子 2020-05-07
xiongweiwei00 2020-04-29
Cypress 2020-04-25
冰蝶 2020-04-20