Mouseover Image Change
JavaScript Change Image
Description: This JavaScript code will change image automatically when the user puts their cursor
on the corresponding link.
Sample:
Implement:
- Insert JavaScript Code
- Decide which images you wish to use, and upload them into the images folder of your
web site.
- Highlight "images" fold in Folder List
- Click File, go to Import. The "import window will jump out.
- Click "Add File...". Then the "Add File to Import List" Window appears.
- Go to the right fold to select an image
- Repeat III and IV to add all images into the Import List
- Click OK
- Highlight the following JavaScript code, click edit in tool bar, click Copy.
- Use the FrontPage to open the web page where the cycle image will be added.
- Insert image first
- Click "Insert" in tool bar, go to "Picture", click "From File..."
- Click folder named "images"
- Pick one of images there. Click it.
- If necessary, fix the image size by mouse
- Click HTML in the bottom of this page to go to html version.
- Put the cursor behind tag <body> and click Edit in tool bar , click Paste. You will see that JavaScript code is pasted
there.
- Get rid of both <xmp> and </xmp> tags. It is an important step otherwise the JavaScript will not act in your web page.
- Change path/01.jpg, path/02.jpg, path/03.jpg, path/04.jpg to the name of images which you want to show. Attention: path represents the path to access the image and *.jpg represents image name. Change them
to right path and name to access the image
- Click Normal at the bottom in the page to go to Normal version
- Rename Image
- Click HTML at the bottom of the page to go to html view
- Change the image name to "picture". If there is no "name" item in <img> tag, add it
by typing "name=picture " in it. It will look like <img name="picture" border="0" src="images/01.jpg" width="369" height="265">.
- Go to Normal version by click Normal in bottom of the page
- high light the link that you want the image changing when you put cursor on that link.
- Go back to HTML version, you will see there is high light part. In front of the high
light, it should be <href> tag. Add onmouseover="doButtons('images/01.jpg')" onmouseout="doButtons('path /01.jpg')" somewhere in <herf> tag. change images to the path and 01.jpg to the image
name. Attention: path represents the path to access the image and *.jpg represents image name. Change them
to right path and name to access the image
- Repeat step d, e, f until all images are added to corresponding <href> tag
- save your page