i have the following code...
i used an anonymous function because i was having trouble passing values to the name functions. now that i'm using anonymous function though, i don't know how to remove the event listener. this doesn't work...Code:for (i=0; i<5; i++) { var t = document.getElementById('div'+i); t.addEventListener('mouseover',function () {adminStyle(this.id,'over');},false); t.addEventListener('mouseout',function () {adminStyle(this.id,'out');},false); t.addEventListener('dblclick',function () {lightWindow('linkDemo');},false); }
i believe in order to solve my issue i need to know one of two things...Code:for (i=0; i<5; i++) { var t = document.getElementById('div'+i); t.removeEventListener('mouseover',function () {adminStyle(this.id,'over');},false); t.removeEventListener('mouseout',function () {adminStyle(this.id,'out');},false); t.removeEventListener('dblclick',function () {lightWindow('linkDemo');},false); }
1 - how do i addEventListener and pass variables to the function that is to be called on the specified event?
or
2 - how do i removeEventListener if it's an anonymous function?
got the time, and i'd love the answer to both. if not, just one will do fine, thanks for your time =)



Reply With Quote

Bookmarks