首页 > 代码库 > addEventListener

addEventListener

function Person() {    this.init()}Person.prototype = {    constructor: Person,    init: function() {        document.documentElement.addEventListener(‘click‘, this, false)    },    handleEvent: function(event) {        this.say()    },    say: function() {        alert(‘hello world!‘)    }}var person = new Person()

 

addEventListener