<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Picture Album</title>
<style>
#wrap{
width: 50%;
margin: 0 auto;
}
#presentation{
float:left;
font-size: 20px;
}
#showing{
float:right;
}
</style>
<script type="text/javascript">
function change(obj) {
var source = obj.getAttribute("href");
var placeholder = document.getElementById("showing");
placeholder.setAttribute("src", source);
}
</script>
</head>
<body>
<h1 style="text-align:center;">Picture Album</h1>
<div id="wrap">
<div id="presentation">
<ul>
<li><a href="photo/blue.jpg" onclick="change(this);return false;">Blue</a></li>
<li> <a href="photo/fire.jpg" onclick="change(this);return false;">Fire</a></li>
<li><a href="photo/sex.jpg" onclick="change(this);return false;">Sex</a></li>
</ul>
</div>
<div id="showing">
<img width="300" height="200" src="photo/world.jpg"/>
</div>
</div>
</body>
</html>
想问一下 为什么点击链接后,该页面放置图片的地方的图片没有改变???
Caballarii