最后还是自己搞定了 贴出来 <script language="JavaScript">total = 0 for(i=1;i<=2000;i++) {num=Math.random(); total +=num } average = total/2 average = Math.round(average*1)/1 //configure refresh interval (in seconds) var countDownInterval=average; //configure width of displayed text, in px (applicable only in NS4) var c_reloadwidth=200</script> <ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer><script>var countDownTime=countDownInterval+1; function countDown(){ countDownTime--; if (countDownTime <=0){ countDownTime=countDownInterval; clearTimeout(counter) window.location.reload() return } if (document.all) //if IE 4+ document.all.countDownText.innerText = countDownTime+" "; else if (document.getElementById) //else if NS6+ document.getElementById("countDownText").innerHTML=countDownTime+" " else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds') document.c_reload.document.c_reload2.document.close() } counter=setTimeout("countDown()", 1000); }function startit(){ if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN document.write('离下一次<a href="javascript:window.location.reload()">刷新</a>还有 <b id="countDownText">'+countDownTime+' </b>秒') countDown() }if (document.all||document.getElementById) startit() else window.onload=startit</script>
那个简单<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>无标题页</title> </head> <body> <script> function re() { location.reload(); } document.body.onload=function() { var a=Math.floor(Math.random()*90)+30; a=a*1000; window.setInterval("re()",a); } </script> </body> </html>
Math.random() 0-1之间的浮点数字
<script language="JavaScript">total = 0
for(i=1;i<=2000;i++)
{num=Math.random();
total +=num
}
average = total/2
average = Math.round(average*1)/1
//configure refresh interval (in seconds)
var countDownInterval=average;
//configure width of displayed text, in px (applicable only in NS4)
var c_reloadwidth=200</script>
<ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer><script>var countDownTime=countDownInterval+1;
function countDown(){
countDownTime--;
if (countDownTime <=0){
countDownTime=countDownInterval;
clearTimeout(counter)
window.location.reload()
return
}
if (document.all) //if IE 4+
document.all.countDownText.innerText = countDownTime+" ";
else if (document.getElementById) //else if NS6+
document.getElementById("countDownText").innerHTML=countDownTime+" "
else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
document.c_reload.document.c_reload2.document.close()
}
counter=setTimeout("countDown()", 1000);
}function startit(){
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
document.write('离下一次<a href="javascript:window.location.reload()">刷新</a>还有 <b id="countDownText">'+countDownTime+' </b>秒')
countDown()
}if (document.all||document.getElementById)
startit()
else
window.onload=startit</script>
<head>
<title>无标题页</title>
</head>
<body>
<script>
function re()
{
location.reload();
}
document.body.onload=function()
{
var a=Math.floor(Math.random()*90)+30;
a=a*1000;
window.setInterval("re()",a);
}
</script>
</body>
</html>