Connecting Tech Pros Worldwide Forums | Help | Site Map

remove IE6 mouse event

Newbie
 
Join Date: Nov 2007
Posts: 18
#1: Mar 4 '08
Hi there!


I had some problems putting mouse events to work on IE6 some days ago. After googling a bit I found this solution:

Expand|Select|Wrap|Line Numbers
  1. function addOnMouseOver(obj, id)
  2. {
  3.         obj.onmouseover = function() {
  4.             changeProcessOpacity(id);
  5.             };
  6.         obj = null;
  7. }
  8.  
  9.  
This works fine, and solves me the annoying thing of IE assuming the event, but not doing anythingwith it when I pass it like this

Expand|Select|Wrap|Line Numbers
  1. obj.setAttribute('onmouseover', "changeProcessOpacity(id);");
  2.  
Donīt know if itīs common thing on IE6 or just my "noobity", but it didnīt work...

My question now is how can I remove the event using my approach. Iīm passing an empty function, but IE is not liking it...

Any suggestions would be greatly appreciated.
Thanks in advance,

Nibbus

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Mar 5 '08

re: remove IE6 mouse event


Expand|Select|Wrap|Line Numbers
  1. obj.onmouseover = null;
should remove the event.

IE can't attach events with setAttribute.
Newbie
 
Join Date: Nov 2007
Posts: 18
#3: Mar 6 '08

re: remove IE6 mouse event


Quote:

Originally Posted by acoder

Expand|Select|Wrap|Line Numbers
  1. obj.onmouseover = null;
should remove the event.

IE can't attach events with setAttribute.


Thanks, it seems to work ;)
I kept the obj = null; at the end, I think that it brings no problem.

Thanks again
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Mar 6 '08

re: remove IE6 mouse event


Glad to hear that it worked :)
Reply