主题:帮忙看看这段代码错在哪里?
写好后却只是改变一次,请帮忙看看原因何在?
<html>
<head>
<title>无标题文档</title>
<script language="javascript">
function Change(){
var colornum=new Array("<font color='blue'>hello</font>","<font color='red'>hello</font>","<font color='green'>hello</font>");
var num=Math.floor(Math.random()*3);
document.write();
document.write(colornum[num]);
setTimeout("Change()",500);
}
</script>
</head>
<body>
<script language="javascript">Change();</script>
</body>
</html>
<html>
<head>
<title>无标题文档</title>
<script language="javascript">
function Change(){
var colornum=new Array("<font color='blue'>hello</font>","<font color='red'>hello</font>","<font color='green'>hello</font>");
var num=Math.floor(Math.random()*3);
document.write();
document.write(colornum[num]);
setTimeout("Change()",500);
}
</script>
</head>
<body>
<script language="javascript">Change();</script>
</body>
</html>

您所在位置: