在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ html中內(nèi)聯(lián)中onclick= "test(this)"

html中內(nèi)聯(lián)中onclick= "test(this)" 的this如何傳遞到封裝的原型中?

<div class="one" onclick="test(_this)">1</div>


function test(_this){
//如這個測試例子
    var ele = _this.parentNode,parentNode;
    ele.removChild(_this.parentNode)
}
//要定義成這種結(jié)構(gòu)
(function(window,document,$){
    var Fn = function(){
    }
    Fn.prototype={

    }
})(window,document,$)

不知道在原型對象中如何拿到那個_this。

回答
編輯回答
安淺陌

不明白你的意思,這兩個this不是一個this。onclick里的this應(yīng)該是指事件對象,你原型鏈里的this是指fn的實例對象

2018年8月23日 21:08