<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Color Picker</title>
</head>
<body>
<div style="width:200px;height:200px;"><img id="shirt" src="images/RedTShirt.jpg" alt="" /></div>
<div style="width:40px;height:40px;float:left;"><a href="javascript:changeImage(1);"><img src="images/blue.jpg" alt="" /></a></div>
<div style="width:40px;height:40px;float:left;"><a href="javascript:changeImage(2);"><img src="images/red.jpg" alt="" /></a></div>
<div style="width:40px;height:40px;float:left;"><a href="javascript:changeImage(3);"><img src="images/green.jpg" alt="" /></a></div>
<div style="width:40px;height:40px;float:left;"><a href="javascript:changeImage(4);"><img src="images/gray.jpg" alt="" /></a></div>
<div style="width:40px;height:40px;float:left;"><a href="javascript:changeImage(5);"><img src="images/yellow.jpg" alt="" /></a></div>
<script language="javascript" type="text/javascript">
var tshirts = new Array("images/BlueTShirt.jpg","images/RedTShirt.jpg","images/GreenTShirt.jpg","images/GrayTShirt.jpg","images/YellowTShirt.jpg");
function changeImage(color) {
document.getElementById('shirt').src = tshirts[color];
}
</script>
</body>
</html>
|