Javascript 随机函数的setInterval
我需要为该功能设置约1秒的时间间隔:Javascript 随机函数的setInterval,javascript,jquery,setinterval,Javascript,Jquery,Setinterval,我需要为该功能设置约1秒的时间间隔: function random_imglink(){ var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="/documents/templates/bilgiteknolojileri/standalone.swf" myimages[2]="/documents/temp
function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="/documents/templates/bilgiteknolojileri/standalone.swf"
myimages[2]="/documents/templates/bilgiteknolojileri/mobil.swf"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<embed wmode="transparent" src="'+myimages[ry]+'" height="253" width="440"></embed>')
}
random_imglink()
函数随机\u imglink(){
var myimages=新数组()
//指定下面的随机图像。您可以拥有任意数量的图像
myimages[1]=“/documents/templates/bilgiteknolojileri/standalone.swf”
myimages[2]=“/documents/templates/bilgiteknolojileri/mobil.swf”
var ry=Math.floor(Math.random()*myimages.length)
如果(ry==0)
ry=1
文件。写入(“”)
}
随机_imglink()
请smb帮助 简单:
setTimeout("javascript statement",milliseconds);
使用setInterval(随机\u imglink,1000)代码>
另见:
如果要调用该函数一次,请使用“设置超时”。如果要连续调用函数,请使用“setInterval”
e、 g
注意:然后,您可以使用以下命令停止正在调用的函数:
clearInterval( intervalID );
var intervalID = setInterval( "random_imglink()", 1000 );
clearInterval( intervalID );