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

鍍金池/ 問答/HTML/ 代碼執(zhí)行的問題

代碼執(zhí)行的問題

var a = document.querySelector(".a");
var b = document.querySelector(".b");

function Student() {
    this.bbb();
}

function add(Student) {
    Student.prototype.bbb = function() {
        this.getName();
        this.jiao();
        console.log(this);
    };
    Student.prototype.getName = function() {
        console.log(this);
        hh(a, "click", this, false);
    };
    Student.prototype.jiao = function() {
        alert("汪汪汪");
    };
}


function hh(dom, type, fn, capture) {
    dom.addEventListener(type, fn, capture);
}

add(Student);

var c = new Student();

我點(diǎn)擊dom為什么沒有響應(yīng)

回答
編輯回答
吃藕丑

你把Student傳進(jìn)點(diǎn)擊事件了

//試試
hh(a, 'click', this.jiao, false);
2018年1月24日 12:25
編輯回答
幼梔

你這是啥啊

clipboard.png

從開始到結(jié)束你事件都沒給綁定上啊

2017年7月30日 08:04
編輯回答
話寡
hh(a, 'click', this, false);

這個(gè)有問題
你傳this干嘛,this又不是函數(shù),你當(dāng)然調(diào)用不了了,要調(diào)用jiao

 hh(a, 'click', this.jiao, false);
2018年9月21日 08:33