html中图片轮播怎么弄
1个回答
展开全部
一、数字键控制代码:
<div style="position:relative; top:-50px; left:240px;">
<a href="javascript:show(1)"><span id="I1" style="width:18px; text-align:left; background:gray">1</span></a>
<a href="javascript:show(2)"><span id="I2" style="width:18px;text-align:left;background-color:gray">2</span></a>
<a href="javascript:show(3)"><span id="I3" style="width:18px;text-align:left;background-color:gray">3</span></a>
<a href="javascript:show(4)"><span id="I4" style="width:18px;text-align:left;background-color:gray">4</span></a>
<a href="javascript:show(5)"><span id="I5" style="width:18px;text-align:left;background-color:gray">5</span></a>
<a href="javascript:show(6)"><span id="I6" style="width:18px;text-align:left;background-color:gray">6</span></a></div>
<script language="javaScript">
var nowIndex=1;
var maxIndex=6;
function show(index)
{
if(Number(index)){
clearTimeout(theTimer);
nowIndex=index;
}
for(var i=1;i<(maxIndex+1);i++){
if(i==nowIndex)
{document.getElementById('pic'+nowIndex).style.display='';
document.getElementById('I'+nowIndex).style.backgroundColor='red';}
else
{document.getElementById('pic'+i).style.display='none';
document.getElementById('I'+i).style.backgroundColor='gray';}
}{
if(nowIndex==maxIndex)
nowIndex=1;
else
nowIndex++;
}
theTimer=setTimeout('show()',3000);
}
</script>
</div>
二、图片自动播放:
<div id="butong_net_left" style="overflow:hidden;width:1000px;">
<table cellpadding="0" cellspacing="0" border="0">
<tr><td id="butong_net_left1" valign="top" align="center">
<table cellpadding="2" cellspacing="0" border="0">
<tr align="center">
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询