×

attachevent 程序 c

关于js中使用attachEvent函数注册的处理程序中的this值?calmly的意思

admin admin 发表于2022-05-20 15:12:35 浏览120 评论0

抢沙发发表评论

关于js中使用attachEvent函数注册的处理程序中的this值


    //这是IE下的一个著名的bug
    //绑定事件想解决this的指向问题,请用下边的自定义方法,事件处理方法中this始终指向目标元素
    var addEvent = (function(){
        if( d.addEventListener ){
            return function(el, type, fn){
                var _len = el.length;
                if( _len ){
                    for(var i=0; i《_len; i++){
                        addEvent(el[i], type, fn);
                    }   
                }else{
                    el.addEventListener(type, fn, false);
                }   
            };  
        }else if( d.attachEvent ){
            return function(el, type, fn){
                var _len = el.length;
                if( _len ){
                    for(var i=0; i《_len; i++){
                        addEvent(el[i], type, fn);
                    }   
                }else{
                    el.attachEvent(’on’ + type, function(){
                        return fn.call(el, w.event);
                    }); 
                }   
            };  
        }   
    })();

calmly的意思


calmly
[英][’kɑ:mlɪ][美][ˈkɑmlɪ]
adv.平静地;宁静地;冷静地;沉着地
[例句]She displayed her body calmly, as a good thing. 她冷静地展示着她的身体,就像一件宝贝

irreplaceable 如何使用到句子里


If Darwin were not so irreplaceable as Lincoln, that should not gainsay his accomplishment.

即使达尔文并不是象林肯那样不可替代,但这并不会否认他的成就。

The ensuing losses, both on a personal and national level, were inestimable and irreplaceable.

无论在个人或国家的层次上,这个损失是极为惨重并难以弥补的。

So the reason to keep languages alive is really just because they are an irreplaceable part of our common human heritage.

所以让人继续去说那些语言的真正原因只是因为它们是我们人类共同遗产中不可替代的一部分。
-程序