<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
</style>
</head>
<body>
<div id="uii">
<a href="https://xn--xu0a.cn/api/dn?1" title="图片1">
<img src="https://xn--xu0a.cn/api/dn?1" width="100px" alt="图片1"/>
</a>
<a href="https://xn--xu0a.cn/api/dn?2" title="图片2">
<img src="https://xn--xu0a.cn/api/dn?2" width="100px" alt="图片2"/>
</a>
<a href="https://xn--xu0a.cn/api/dn?3" title="图片3">
<img src="https://xn--xu0a.cn/api/dn?3" width="100px" alt="图片3"/>
</a>
<a href="https://xn--xu0a.cn/api/dn?4" title="图片4">
<img src="https://xn--xu0a.cn/api/dn?4" width="100px" alt="图片4"/>
</a>
</div>
<div style="clear:both"></div>
<img id="image" src="https://xn--xu0a.cn/api/dn?5" alt="" width="450px"/>
<p id="des">选择一个图片</p>
<script>
var uii = document.getElementById("uii");
var links = uii.getElementsByTagName("a");
var image = document.getElementById("image");
var des = document.getElementById("des");
for (var i = 0; i <= links.length - 1; i++){
links[i].onclick = function(){
image.src = this.href;
des.innerText = this.title;
return false;
};
}
</script>
</body>
</html>