Thread: Mouse Overs
View Single Post
Old 04-20-2002, 10:45 PM   #4
Neranz Laverani
Member
 
Join Date: Apr 2002
Location: The States
Posts: 116
Neranz Laverani is on a distinguished road
Here is an example if you meant changing buttons for when users put their mouse over the button.

The example uses two images: g_homeon.gif and g_homeoff.gif. g_homeoff.gif loads by default on the page and shows whenever the user does not have their browser over the "button." g_homeon.gif shows whenever the user's button is over the image.

[code]

JavaScript;
<script language="JavaScript">
<!--
if (document.images) {
mainon = new Image();
mainon.src = "g_homeon.gif";

mainoff = new Image();
mainoff.src = "g_homeoff.gif";
}

function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "on.src");
}
}

function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + "off.src");
}
}


// -->
</script>

HREF;
<a href="index.html" onMouseOver="imgOn('main')" onMouseOut="imgOff('main')"><img src="g_homeoff.gif" name="main" alt="Home" border="0" width="128" height="20"></a>

[/quote]

This is the javascript that I use on The Art of Building. If you want to see what it looks like in a page, click on The Art of Building in my signature and view the source on the first page that loads.

Neranz Laverani, Seeker of Knowledge
Neranz Laverani is offline   Reply With Quote