function Button(id){
this.element = document.getElementById(id);
console.log(this.element);
this.bindEvent();
}
Button.prototype.bindEvent = function(){
this.element.addEventListener('click',this.setBgColor, false)
};
Button.prototype.setBgColor = function(){
this.element.style.backgroundColor = '#1abc9c'
}
var button = new Button('id');
console.log(button);
<button id="id">点击变色</button>