作者demythig (demy)
看板Ajax
标题Re: [问题] c转javascript。rand()和Sleep()要怎麽 …
时间Wed Jan 30 17:00:51 2008
请问我是在哪个地方有写错?
<head>
<script LANGUAGE="JavaScript">
<!--
function setFrame(){
var x =[];
x[0]="
http://tw.yahoo.com/";
x[1]="
http://www.google.com/";
x[2]="
http://www.pchome.com/";
var i=Math.round(Math.random()*(x.length-1))
parent.main.location.href = x[i];
}
function main(){
var loop;
var randtime;
document.write("the", "<br>");
while( loop){
randtime=Math.random()*2000+3000; //3~5秒
document.write("sec:", randtime);
setInterval("setFrame()", randtime);
}//无限回圈
}
</script>
</head>
<body>
<body onload="main()">
</body>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.225.5.241