Jump to content

dynamically change onmouseover/onmouseeout


atomicrabbit

Recommended Posts

how do I do it???

 

I searched google and came up with a few solutions, but none seem to fit my needs, or they just didnt work. I'm using this code in the html:

<td id="showcase1">
<a href="link_goes_here" id="showcase1_link1" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('name','','path/to/rollover_image.jpg',1)"><img src="path/to/main_image.jpg" id="showcase1_img" /></a>
</td>

 

and I found a couple different solutions to change the onmouseover/out events dynamically:

link1 = document.getElementById('showcase1_link1');

// first
link1.onmouseover=function(){ MM_swapImage('Another Name','','path/to/another/rollover_image.jpg',1) };

// OR

// second
link1.addEventListener('mouseover',MM_swapImage,false);

 

but the first one doesn't seem to work??? and the second one does not take parameters for the 'MM_swapImage' function.

well I sorta solved my problem. Instead of editing the onmouseover/out events, I just edited the .innerHTML attribute and changed the entire link.

 

That was good enough for me. I spent too much time trying to figure it out.

 

If anyone still knows how to do what I'm asking, feel free to reply!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.