一个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,"span","xxdqpic","dis","undis");
fiterplay(s,num,"span","xxdqpic","","f1");
fiterplay(i,num,"span","xxdqpic","dis","undis");
filters[0].play();
}
}
catch(e)
{
fiterplay(b,num,"span","xxdqpic","dis","undis");
fiterplay(s,num,"span","xxdqpic","","f1");
fiterplay(i,num,"span","xxdqpic","dis","undis");
}
}
var autoStart = 0;
var n = 0;var s = getid("simg");
var x = getNames(s,"xxdqpic","span");
function clearAuto() {clearInterval(autoStart);};
function setAuto(){autoStart=setInterval("auto(n)", 2000)}
function auto(){
n++ ;
if(n>(x.length-1))
{ n = 0;
clearAuto();
}
play(x[n],n);
}
function ppp(){
setAuto();
}
ppp();
[解决办法]
<script language="JavaScript" type="text/javascript">
var tpics = '';
var tlinks = '';
var ttexts = '';
</script>
<!-- BEGIN imgnews -->
<script language="JavaScript" type="text/javascript">
tpics = 'images/d1.jpg|images/cecL4cvGRPb0A.jpg|images/d3.jpg|images/d4.jpg|images/1101.jpg|images/d6.jpg|';
tlinks = 'company.htm|company.htm|company.htm|company.htm|company.htm|company.htm';
ttexts = 'a维修|b维修|c维修|d维修|e维修|f维修';
</script>
<!-- END imgnews -->
<script language="JavaScript" type="text/javascript">
var focus_width=198; //图片的宽度
var focus_height=170; //图片的高度
var text_height=0; //标题栏的宽度
var swf_height = focus_height+text_height;
var pics = tpics.substr(0, tpics.length - 1);
var links = tlinks.substr(0, tlinks.length - 1);
var texts = ttexts.substr(0, ttexts.length - 1);
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="flash/play.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="" />');
document.write('</object>');
//注意FLAH的路径地址
</script>