HTML中轮播代码如下:
<!DOCTYPE html><html>
<head><title>轮播代码</title>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=10,maximum-scale=10,minimum-scale=10,user-scalable=0">
</head>
<style type="text/css">
body{max-width: 640px;margin: 0 auto;}
#lunbo ul li{width:100%;list-style: none;width:640px; height:250px;background-color: #f00;text-align: center;}
#lunbo ul li:not(:first-child){display: none;}</style><body><div id="lunbo">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul></div><script type="text/javascript">
//因为使用了document,所以js需要放在需要执行的代码下面生效才能生效
var li=documentgetElementById('lunbo')getElementsByTagName("li");
var num=0;
var len=lilength;
setInterval(function(){
li[num]styledisplay="none";
num=++num==len0:num;
li[num]styledisplay="inline-block";
},3000);//切换时间
</script>
</body>
</html>
欢迎分享,转载请注明来源:表白网
评论列表(0条)