Sunday, October 9, 2011

The JavaScript Source: Image Effects: Image BG Changer

<!-- TWO STEPS TO INSTALL BACKGROUND CHANGER:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Mark Whitnell (mwhitnel@southeast.net) -->
<!-- Web Site:  http://users.leading.net/~mwhitnel -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
if (navigator.appName == "Microsoft Internet Explorer") {
image_directory = "http://javascript.internet.com/img/bg-changer/";
clear = new Image();  clear.src = image_directory + "clear.jpg";
pic1 = new Image();  pic1.src = image_directory + "chameleon.jpg";
pic2 = new Image();  pic2.src = image_directory + "gecko.jpg";
pic3 = new Image();  pic3.src = image_directory + "lizard.jpg";
pic4 = new Image();  pic4.src = image_directory + "toad.jpg";
}
function imagechange(imgName) {
if (navigator.appName == "Microsoft Internet Explorer") {
document.body.background = eval(imgName + ".src");
   }
}
//  End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<body background="clear.jpg" name=bg>

<a href="#" onMouseOver="imagechange('pic1');" onMouseOut="imagechange('clear');"><img src="chameleon.jpg"></a>
<a href="#" onMouseOver="imagechange('pic2');" onMouseOut="imagechange('clear');"><img src="gecko.jpg"></a>
<a href="#" onMouseOver="imagechange('pic3');" onMouseOut="imagechange('clear');"><img src="lizard.jpg"></a>
<a href="#" onMouseOver="imagechange('pic4');" onMouseOut="imagechange('clear');"><img src="toad.jpg"></a>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  1.75 KB -->

No comments:

Post a Comment