Welcome to WebmasterWorld Guest from

Forum Moderators: mack

Message Too Old, No Replies

I need to create a onMouseOver that will change gif's randomly

New to web programming



8:15 pm on Dec 11, 2002 (gmt 0)

Inactive Member
Account Expired


I would like to create a onMouseOver that will display a different image on each mouseover and change to the default onMouseOut
8:19 pm on Dec 11, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
votes: 0

Welcome to WebmasterWorld hogman,

You want to have a rollover button that when you rollover it, it will chose a random image to swap, then switch back to the original?


8:27 pm on Dec 11, 2002 (gmt 0)

Inactive Member
Account Expired


Yes that is exactly what I am looking for.
10:32 pm on Dec 23, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Dec 22, 2002
votes: 0

<script type="text/javascript" language="Javascript">
var images = new Array ()

images[images.length] = '<URL for img1>'
images[images.length] = '<URL for img2>'
images[images.length] = '<URL for imgN>'

function randomised(toChange)
toChange.src = images[Math.floor(Math.random()*images.length)]
<img src="<img-file>" alt="" onmouseover="randomised(this)" onmouseout="this.src='<img-file>'">

Simple :-)


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members