Metachecker.net
|
FontsMadeEasy.com
|
RankChecker.net
Learn Java Script Today
|
Over 5000 Free Fonts
|
Tutorials
|
Javascript Forum
|
Other Javascript Resources
|
Cheat Sheet
JavaScript Basics
Inserting Javascript
Complete Tutorial
Advance DHTML Tutorial
Script archive
Advanced Tutorials
Alert Scripts
Animation
Audio
Background Effects
Banner Ads
Browser Window
Buttons
Button Forms
Calculcators
Calendars
Clocks & Dates
Cookies
Cursor Effects
DHMTL Games
DHTML Miscellaneous
Equivalents
Forms
Games
IE4+ Scripts
IE5+ Scripts
Image Effects
Image Miscellaneous
Links & Buttons
Math Related
Messages Miscellaneous
Miscellaneous
Mouse Tricks
Navigation
Page Details
Password Protection
Pulldown Menus
Random Stuff
Scrolling
Status Bar
Text Animation
User Detail
User Info
Window Control
Changing Images - Plus One Alt Image Changes
Insert into <HEAD>
<script language="JavaScript"> <!-- Hide from old browsers if (navigator.appVersion.indexOf("2.") != -1){ check = false; } if ((navigator.appVersion.indexOf("3.") != -1) && (navigator.appName.indexOf("Explorer") != -1)){ check = false; } else { check = true; } image1= new Image(); image1.src = "IMAGE FILE OFF"; image1on = new Image(); image1on.src = "IMAGE FILE ON"; image1alt = new Image(); image1alt.src = "YOUR ORIGIONAL ALT IMAGE"; image1alton = new Image(); image1alton.src = "YOUR CHANGING FIRST ALT IMAGE"; image2 = new Image(); image2.src = "IMAGE FILE OFF"; image2on = new Image(); image2on.src = "IMAGE FILE ON"; image2alt = new Image(); image2alt.src = "YOUR ORIGIONAL ALT IMAGE"; image2alton = new Image(); image2alton.src = "YOUR CHANGING SECOND ALT IMAGE"; function imageon(name) { document[name].src = eval(name + "on.src"); document["altimg"].src = eval(name + "alton.src"); } function imageoff(name) { document[name].src = eval(name + ".src"); document["altimg"].src = eval(name + "alt.src"); } NN3 = true; function on(name) { if (check == true){ imageon(name);} } function off(name) { if (check == true){ imageoff(name);} } // --> </script>
Insert into <BODY>
Changing Image #1: <a href="YOUR LINK" onmouseover="on('image1');" onmouseout="off('image1')"><img src="IMAGE FILE OFF" border="0" name="image1"></a> Changing Image #2: <a href="YOUR LINK" onmouseover="on('image2');" onmouseout="off('image2')"><img src="IMAGE FILE OFF" border="0" name="image2"></a> Changing Alternate Image: <img src="YOUR ORIGIONAL ALT IMAGE" name="altimg">
Other Options
First thing to do is to put this in your <head></head> tag. You will need to edit ALT YOUR CHANGING FIRST ALT IMAGE, YOUR CHANGING SECOND ALT IMAGE, IMAGE ON, ALT IMAGE OFF, IMAGE FILE OFF, and IMAGE FILE ON. <script language="JavaScript"> <!-- Hide from old browsers if (navigator.appVersion.indexOf("2.") != -1){ check = false; } if ((navigator.appVersion.indexOf("3.") != -1) && (navigator.appName.indexOf("Explorer") != -1)){ check = false; } else { check = true; } image1= new Image(); image1.src = "IMAGE FILE OFF"; image1on = new Image(); image1on.src = "IMAGE FILE ON"; image1alt = new Image(); image1alt.src = "YOUR ORIGIONAL ALT IMAGE"; image1alton = new Image(); image1alton.src = "YOUR CHANGING FIRST ALT IMAGE"; image2 = new Image(); image2.src = "IMAGE FILE OFF"; image2on = new Image(); image2on.src = "IMAGE FILE ON"; image2alt = new Image(); image2alt.src = "YOUR ORIGIONAL ALT IMAGE"; image2alton = new Image(); image2alton.src = "YOUR CHANGING SECOND ALT IMAGE"; function imageon(name) { document[name].src = eval(name + "on.src"); document["altimg"].src = eval(name + "alton.src"); } function imageoff(name) { document[name].src = eval(name + ".src"); document["altimg"].src = eval(name + "alt.src"); } NN3 = true; function on(name) { if (check == true){ imageon(name);} } function off(name) { if (check == true){ imageoff(name);} } // --> </script> Now put these lines anywhere in you HTML document Changing Image #1: <a href="YOUR LINK" onmouseover="on('image1');" onmouseout="off('image1')"><img src="IMAGE FILE OFF" border="0" name="image1"></a> Changing Image #2: <a href="YOUR LINK" onmouseover="on('image2');" onmouseout="off('image2')"><img src="IMAGE FILE OFF" border="0" name="image2"></a> Changing Alternate Image: <img src="YOUR ORIGIONAL ALT IMAGE" name="altimg"> Now change YOUR LINK, IMAGE FILE OFF, and YOUR ORIGIONAL ALT IMAGE. Now if you want add more images, you'll have to adjust the top script by adding this additional line (This is an example of how to add a third image image). This goes after the lines that look identical. image3 = new Image(); image3.src = "IMAGE FILE OFF"; image3on = new Image(); image3on.src = "IMAGE FILE ON"; image3alt = new Image(); image3alt.src = "YOUR ORIGIONAL ALT IMAGE"; image3alton = new Image(); image3alton.src = "YOUR CHANGING THIRD ALT IMAGE"; Notice how "image2alt" went to "image3alt" and "image2alton" went to "image3alton". To add a fourth image you would replace all the "image3alt"'s with "image4alt" and so on. Now put this link in the body of your document to make the third image visible. Changing Image #3 <a href="YOUR LINK" onmouseover="on('image3');" onmouseout="off('image3')"><img src="IMAGE FILE OFF" border="0" name="image3"></a> Notice how the image number went up to "image3". Repet all the steps that I just showed you to put in a fourth or fifth image and change "image3" to "image4" or "image5". Same goes for "image3alt".