有一段轮播的代码html的body部分<>我发现把这个里面的style拿走,写到css部分里面去就不行,不知道为何?可以正常运行的html全部。*{margin:0;padding:0;text-decoration:none;}body{padding:20px;}#container{width:600px;height:392px;border:3pxsolid#333;overflow:hidden;position:relative;margin:0auto;}#list{width:4200px;height:400px;position:absolute;z-index:1;}#listimg{float:left;width:600px;height:392px;}#buttons{position:absolute;height:10px;width:100px;z-index:2;bottom:20px;left:250px;}#buttonsspan{cursor:pointer;float:left;border:1pxsolid#fff;width:10px;height:10px;border-radius:50%;background:#333;margin-right:5px;}#buttons.on{background:orange;}.arrow{cursor:pointer;display:none;line-height:30px;text-align:center;font-size:36px;font-weight:bold;width:40px;height:40px;position:absolute;z-index:2;top:180px;background-color:RGBA(0,0,0,.5);color:white;}.arrow:hover{background-color:RGBA(0,0,0,.7);}#container:hover.arrow{display:block;}#prev{left:20px;}#next{right:20px;}window.onload=function(){varcontainer=document.getElementById('container');varlist=document.getElementById('list');varbuttons=document.getElementById('buttons').getElementsByTagName('span');varprev=document.getElementById('prev');varnext=document.getElementById('next');varindex=1;varchanged=false;vartimer;functionshowButton(){for(vari=0;i0&&parseInt(list.style.left)-600){list.style.left=-3000+'px';}if(newleft
添加回答
举报
0/150
提交
取消