Click to See Complete Forum and Search --> : Hover Button


TLMM
07-23-2003, 07:42 PM
I have a problem that I can't figure out. I want to hover over a button and have it change on the hover to a new image.

All the code for this functionality is in a header which is called from the main page using #include. If I run the header by itself, the hover works. The problem is if I run the main page, now the hover doesn't work. I don't understand why??? Is it something to do with the call to the include file (the header)?

Can someone help please???

Thanks.

xataku_nakusute
07-23-2003, 10:05 PM
it would be helpful to post your code so as i know what youre dealing with

TLMM
07-24-2003, 06:49 AM
The code i am using for the hover button functionality is below. As I mentioned, it works fine when I run the header by itself, but when I run the main page which calls the header code through an include, now it does not work.

<SCRIPT LANGUAGE="javascript">
<!--
if (parseInt(navigator.appVersion) > 2)
{
//Load all images
var Home = new Image(20,48);
var HomeOn = new Image(20,48);

//Setting the SRC of the image to the GIFs
Home.src = "../images/Home.gif";
HomeOn.src = "../images/HomeOn.gif";

}

//Called from the onmouseover and onmouseout events to set the specific image. "
function setImage(imgName, type)
{
var imgFile = eval(imgName + type + ".src");

if (document.images)
{
document.images[imgName].src = imgFile;

return false;
}
}

-->
</SCRIPT>

Here is the line I use for the hover functionality:

<td valign="top"><a href="index.asp" onmouseover="return setImage('Home','On')" onmouseout="return setImage('Home','')"><IMG src="images/Home.gif" alt="" name="Home" height="20" width="48" border="0"></a></td>

And this is how I call the include file from the main page:

<!--#include file="includes/header.asp" -->

If someone can help, it would be greatly appreciated. I can't figure out why it works on it's own, but won't work when called from the main page. Is it something to do with the include???

Thanks.