Jump to content

[SOLVED] Simple Mouseover


allistera

Recommended Posts

Hey there, I have made a simple JS mouse over:

 

function mouseOver()
{
document.home.src ="images/homeO.gif";
}
function mouseOut()
{
document.home.src ="images/home.gif";
}

 

<img src="images/home.gif" id="home" onmouseout="mouseOut()" onmouseover="mouseOver()" alt="Home" />

 

Works fine in firefox, but not in IE, I don't know JS, just this simple mouseOver.

Any help?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/103764-solved-simple-mouseover/
Share on other sites

try this instead:

 

function mouseOver(ele, path)
{
ele.src = path;
}
function mouseOut(ele, path)
{
ele.src = path;
}

 

<img src="images/home.gif" id="home" onmouseout="mouseOut(this,'images/home.gif')" onmouseover="mouseOver(this,'images/homeO.gif')" alt="Home" />

 

it's more generic too, so you can use it in several places

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.