日期:2014-05-17  浏览次数:20720 次

一个JS轮换图片的问题
目前轮换只播放一次, 我想让它一直循环播放,请大家指导一下


[b]前台代码[/b]

  <!--图片切换广告开始,图片大小 width:318;height:177-->

  <div id=lantern_slide class="town_pictabs">
  <div id="bimg"> 
  <span class=dis name="xxdqpic"><a href="http://www.114xxdq.com/"><img alt=中国城乡信息大全 src="images/24.jpg" /></a></span>
  <span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/"><IMG alt=中国城乡信息大全 src="images/02.jpg"></A></span>
  <span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/"><IMG alt=中国城乡信息大全 src="images/03.jpg"></A></span>
  <span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/"><IMG alt=中国城乡信息大全 src="images/04.jpg"></A></span 
  ><span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/"><IMG alt=中国城乡信息大全 src="images/05.jpg"></A></span> 
  </div>
  <div id=font_hd>
  <div class=town_text id=info> 
  <span class=dis name="xxdqpic"><A href="http://www.114xxdq.com/">科长,你个批眼虫,中国城乡1</A></span> 
  <span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/">科长,你个批眼虫,中国城乡2</A></span> 
  <span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/">科长,你个批眼虫,中国城乡3</A></span> 
  <span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/">科长,你个批眼虫,中国城乡4</A></span> 
  <span class=undis name="xxdqpic"><A href="http://www.114xxdq.com/">科长,你个批眼虫,中国城乡5</A></span> 
  </div>
  <div id=simg class="town_nums"> 
  <span onclick=play(x[0],0) name="xxdqpic">1</span> 
  <span class=f1 onclick=play(x[1],1) name="xxdqpic">2</span> 
  <span class=f1 onclick=play(x[2],2) name="xxdqpic">3</span> 
  <span class=f1 onclick=play(x[3],3) name="xxdqpic">4</span> 
  <span class=f1 onclick=play(x[4],4) name="xxdqpic">5</span> 
  </div>
  </div>
  <SCRIPT src="js/picshow.js" type=text/javascript></SCRIPT>
  </div>

[b]js代码[/b]

function getid(o){ return (typeof o == "object")?o:document.getElementById(o);}
function getNames(obj,name,tij)
{
var plist = getid(obj).getElementsByTagName(tij);
var rlist = new Array();
for(i=0;i<plist.length; ++i){if(plist[i].getAttribute("name") == name){rlist[rlist.length] = plist[i];}}
return rlist;
}

function fiterplay(obj,num,t,name,c1,c2)
{
var fitlist = getNames(obj,name,t);
for(i=0;i<fitlist.length;++i)
{
if(i == num)
{
fitlist[i].className = c1;
}
else
{
fitlist[i].className = c2;
}
}
}
function play(obj,num)
{
var s = getid('simg');
var i = getid('info');
var b = getid('bimg');
try
{
with(b)
{
filters[0].Apply();
fiterplay(b,num,"s