标签:show body har head oct utf-8 html get type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<button onclick="imgChange(1)">第1张图片</button>
<button onclick="imgChange(2)">第2张图片</button>
<button onclick="imgChange(3)">第3张图片</button>
<button onclick="imgChange(4)">第4张图片</button>
<div style="margin-top:20px;">
<img src="img/1.jpg" id="imgShow" width="250" height="250">
</div>
<script>
var imgShow = document.getElementById("imgShow");
function imgChange(i)
{
imgShow.src = "img/"+i+".jpg";
}
</script>
</body>
</html>
点击换图片....
虽然简单,但是能有很多衍生的事件可以做
标签:show body har head oct utf-8 html get type
原文地址:http://www.cnblogs.com/dzy1997-com/p/6534548.html