Backgroud Changer

Posted: December 15, 2007 in JavaScript Stuffs

Heading Backgroud Changer

Description JavaScript “Backgroud Changes on click”

Preview N/A

Code

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2 Final//EN”>
<HTML>
<HEAD>
<META NAME=”Generator” CONTENT=”Microsoft FrontPage 5.0″>
<LINK href=”general.css” rel=”stylesheet” type=”text/css”>
<SCRIPT LANGUAGE=”JavaScript”>
<!– Original:  Mark Whitnell (mwhitnel@southeast.net) –>
<!– Web Site:  http://users.leading.net/~mwhitnel –>
<!– Begin
if (navigator.appName == “Microsoft Internet Explorer”) {
image_directory = “”;
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>

<BODY background=”clear.jpg” name=bg>
<center><BR><BR><BR>
<a href=”#” onMouseOver=”imagechange(‘pic1’);” onMouseOut=”imagechange(‘clear’);”>
<img src=”chameleon.jpg” width=”320″ height=”193″></a>
<a href=”#” onMouseOver=”imagechange(‘pic2’);” onMouseOut=”imagechange(‘clear’);”>
<img src=”gecko.jpg” width=”335″ height=”193″></a>
<a href=”#” onMouseOver=”imagechange(‘pic3’);” onMouseOut=”imagechange(‘clear’);”>
<img src=”lizard.jpg” width=”334″ height=”191″></a>
<a href=”#” onMouseOver=”imagechange(‘pic4’);” onMouseOut=”imagechange(‘clear’);”>
<img src=”toad.jpg” width=”332″ height=”189″></a>

</center>
</BODY>
</HTML>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s