JavaScript简单实现图片点击切换

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<button id="up">上一张</button>
		<button id="below">下一张</button>
		<img id="img" src="../img/cat_five.jpg" />
		<script>
		var ups =document.getElementById('up');
		var belows=document.getElementById('below');
		var srcs = document.getElementById('img');
		ups.onclick = function(){
			img.src='../img/man-1.jpg';
		}
		belows.onclick =function(){
			img.src='../img/cat_five.jpg'
		}	
		</script>		
	</body>
</html>

 JavaScript简单实现图片点击切换JavaScript简单实现图片点击切换

上一篇:填坑webUI自动化js点击


下一篇:四、计时器(JS时间戳和New Data()使用)