function gun(){
this.gun=document.createElement("div")
this.gun.className="gunBox"
document.body.appendChild(this.gun);
var othis = this;
this.move = function(){
document.addEventListener('mousemove',function(e){
othis.gun.style.left = e.clientX - 48+'px';
othis.gun.style.top = e.clientY - 48+'px';
othis.gun.style.display = "block";
})
}
}
javascript的this的理解
JavaScript中的this
换个思路理解Javascript中的this