I have a problem with this for loop
var barClass= document.getElementsByClassName("br");
for(var i=0;i<barClass.length;i++){
barClass[i].addEventListener('mousedown',function() {initMagic(this.event,i);},false);
barClass[i].addEventListener('mouseup',function() {endMagic(this.event,i);},false);
barClass[i].addEventListener('mousemove',function() {mouMove(this.event,i);},false);
}
function initMagic(e,n){
alert(n);
}
Because the result of alert(n)
is identical to barClass.length
any barClass[i]
I will get same result?