Script Categories

Graphic >>> Change Image.

It's always neat to dynamically change an image when the user touches it. For this example, There is one image and when you put your cursor on it, it changes to another. If you use this script, be sure to use images of the same size!


Step 1: Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
// Preload Images
image1 = new Image();
image1.src = "toad.jpg";
image2 = new Image();
image2.src = "lizard.jpg";

function movepic(img_name,img_src) {
// End -->
<!-- Be sure to give each image a name! (<img name="button">)
Include that name in the onmouseover/onmouseout tags! -->
<A HREF=""
<IMG NAME="button" SRC="toad.jpg" ALT="Image" width="333" height="190"></A>

Step 2: The script uses two images as part of its interface. You can create your own, or use the two below (resized for easier download):

(right click images, and select "Save Image As")
Upload them into the same directory as your webpage.

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).