| Home > Computer & I'net > Rollovers / Image Swap... |
|
|
|||||||||||||||
|
|
|||||||||||||||
|
||||||||||||||||
Rollovers / Image Swap | |
The first thing you will need are 2 images. One for normal view, a second for the change. The first image will be placed on the page as it normally would. The one main difference is you have to specify a name in the img tag like so... <img src="image1.gif" name="MyImage"> This image can now be accessed by javascript as document.MyImage. Of course add in the width, height, alt, and border properties as desired too. The next part is to create a link around that image. This will allow javascript to affect the image properties. <a href="" onMouseOver="document.MyImage.src='image2.gif';" onMouseOut="document.MyImage.src='image1.gif';">
<img src="image1.gif" name="MyImage"> </a> SRC is the SouRCe of the image file. ----------------- Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission. | |
| Articles |
•Auto & Trucks•Business•Computer & I'net·General·Apache·CSS·Database·Hardware·HTMLJavascript&DHTML·Linux·MySQL·Operating System·Perl / CGI·PHP·Programming·Publishing·Search Engines·Software Problems·SSI·Tips & Tricks·Utilities·Web Design•Family•Food & Drink•Gardening•Health•Other•Pets•Psychology•Spiritual•Travel•Women |
| Calculators |
|