image rollover

They have: 5,633 posts

Joined: Jan 1970

Need script for Image rollover.Thanks

------------------
-Ace
1975 Jeep

They have: 12 posts

Joined: Feb 2000

Here is a fairly lightweight version.

code:

<!--Put this in the head of your html file-->
<script language="JavaScript"><!--
if(document.images) {
 var image = new Image;
 var image_over = new Image;
 image.src = "URL";
 image_over.src = "URL";
}

 function over(name) { swap(name, "_over"); }
 function out(name) { swap(name, ""); }
 function swap(name, state) {
  if(document.images) {
   eval("document.images['" + name + "'].src = " + name + state + ".src;"); }
 }
//--></script>
<!--And this where you want the rollover-->
<a href=URL onmouseover="over('image');"
            onmouseout="out('image')">
<img src="images/image.gif" border=0 name="image"></a>
[/code]

Just replace image with an appropriate name for your button and URL with the appropriate URL.

For each button you need to make another pair of image and image-over vars.


------------------
"The way that can be told is not the eternal,
 it cannot be defined or explained,
 it can only be experienced..." Ashida Kim

[This message has been edited by joshuac (edited 28 February 2000).] 

"The way that can be told is not the eternal,
it cannot be defined or explained,
it can only be experienced..." Ashida Kim

They have: 231 posts

Joined: Feb 2000

You better change the following line:

var image = new Image;

to

var image = new Image();

------------------
Lloyd Hassell
[email protected]
http://go.to/hass

:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.