<!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></title>
<script type="text/javascript">
icon = new Image();
icon.src = "../image/1.png";
icon2 = new Image();
icon2.src = "../image/2.jpg";
icon3 = new Image();
icon3.src = "../image/3.jpg";
icon4 = new Image();
icon4.src = "../image/4.png";
function showImages(obj) {
// DOM
// var theImg = document.getElementById("myID");
// theImg.src = obj;
// BOM
document.images[0].src = obj;
}
</script>
</head>
<body>
<a href="#" onmouseover="showImages(icon.src)">icon1</a> | <a href="#" onmouseover="showImages(icon2.src)">icon2</a> | <a href="#" onmouseover="showImages(icon3.src)">icon3</a> | <a href="#" onmouseover="showImages(icon4.src)">icon4</a>
<hr />
<img id="myID" src="../image/1.png" width="200px" />
</body>
</html>
沒有留言:
張貼留言