Blogger Information
Blog 25
fans 0
comment 0
visits 19680
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
轮播切换3-27
moonheart的博客
Original
675 people have browsed it

实例

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>javaScript-轮播</title>
	<style type="text/css">
		div{
			width:500px;height: 300px;
			margin: 50px auto;
			overflow: hidden;
			position: relative;
	    }
	    img{
	    	width: 500px;
	    	height: 300px;
	    }
	    p{
	    	color: #fff;
	    	width: 500px;
	    	height: 30px;
	    	position: absolute;	bottom: 0;left: 0;z-index: 1000;    	
	    	text-align: center;
	    	line-height: 30px;

	    }
	    p span{
	    	display: inline-block;
	    	width: 20px;
	    	height: 20px;
	    	text-align: center;
	    	background-color: rgba(254,254,254,0.6);
	    	border-radius: 50%;
	    	line-height: 20px;
	    	cursor: pointer;
	    }


	</style>
</head>


<body>
<div id='photo'>
	<!-- 图片列表 -->
	<a href=""><img src="images/1.jpg"></a>
	<a href=""><img src="images/2.jpg"></a>
	<a href=""><img src="images/3.jpg"></a>
	<a href=""><img src="images/4.jpg"></a>
	<a href=""><img src="images/5.jpg"></a>
	<!-- 图片按钮 -->
	<p>
		<span onclick="change(0);">1</span>
		<span onclick="change(1);">2</span>
		<span onclick="change(2);">3</span>
		<span onclick="change(3);">4</span>
		<span onclick="change(4);">5</span>
	</p>
</div>
<script type="text/javascript">
	function change(num){
		var obj=document.getElementById('photo');
		var obj_a=obj.getElementsByTagName('a');
		// 隐藏a链接
		for(var i=0;i<obj_a.length;i++){
			obj_a[i].style.display='none';
		}
		obj_a[num].style.display='block';
	}
</script>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

微信截图_20190328135608.png微信截图_20190328135617.png

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post