简易轮播图制作

其实这不能算是严格意义上的轮播图,我是借用了DOM HTML来解决的,只有个样子,但是对于新手来说,比较容易做出来,而且不难学`

-----------------------HTML内容-------------------------------------------------------------------------------
<!DOCTYPE html>
<html>
	<head>
		<title>good</title>
		<link rel="stylesheet" href="good.css" style="text/css">
		<meta charset="utf-8">
	</head>
	<body>
	     <div id="list">
		       <div id="div"><img id="img" src="index/1.jpg"></div>
	     </div>
	    <div id="ctrl">
		       <button id="mybutton" onclick="myctrl1()"></button>
		       <button id="mybutton" onclick="myctrl2()"></button>
		       <button id="mybutton" onclick="myctrl3()"></button>
		       <button id="mybutton" onclick="myctrl4()"></button>
		       <button id="mybutton" onclick="myctrl5()"></button>
	    </div>
	    <script>
		     function myctrl1()
             {
	             document.getElementById("img").src="index/1.jpg";
             }
             function myctrl2()
             {
	             document.getElementById("img").src="index/2.jpg";
             }
             function myctrl3()
             {
	             document.getElementById("img").src="index/3.jpg";
             }
             function myctrl4()
             {
	             document.getElementById("img").src="index/4.jpg";
             }
             function myctrl5()
             {
	             document.getElementById("img").src="index/5.jpg";
             }
        </script>
	</body>
</html>
-------------------css内容------------------------------------------------------------------------------------
*{
	padding:0px;
	margin:0px;
	text-decoration:none;
}
#div
{
	width:1280px;
	height:500px;
	margin:100px auto;
}
#ctrl
{
	width:1050px;
	height:15px;
	position:relative;
  top:-100px;
	margin:auto;
}
#mybutton
{
	width:209px;
	height:15px;
	margin-right:1px;
	float:left;
	background-color:#9E9E9E;
	outline:none;
	border:0px;
}
#mybutton:hover
{
	background-color:#0080FF;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值