game15888 发表于 2008-4-6 21:05

帮忙看看错在那里??

<html >
<head>


<script  language="javascript">
function urlList(a,b,c,d,e)
{
this[0] = a;
this[1] = b;
this[2] = c;
this[3] = d;
this[4] = e;
}
function selectPage(list)
{
var today = new Date();
var page = today.getSeconds() % 5 ;
window.open(list[page],"Random-Pages");
}
choice = new urlList("http://www.sina.com.cn","http://www.163.com","http://www.yahoo.com.cn","http://www.china-pub.com","http://www.net130.cn");
</script>
</head>

<body onload="selectPage(choice);">
<h1>
<hr>
Please Wait...Selecting Page
<hr>
</h1>
</body>
</html>

lmhllr 发表于 2008-4-7 01:55

具体什么问题?什么功能的?要让人猜的啊...!!

game15888 发表于 2008-4-7 13:21

这个主要实现随机显示网页,但是调试时候老是提示“window.open(list[page],"Random-Pages");”这行参数无效不知道为什么,请 懂的朋友指教~!谢谢`

game15888 发表于 2008-4-7 15:11

open()方法的参数,它本身是数组啊,page是下标,取得要显示的是哪个网址,你可以把这些代码放你机子上调试上看看什么错误

j2ee126 发表于 2008-4-7 15:23

window.open(list[page],"Random-Pages");这行参数无效是指"Random-Pages"无效!
因为你的页面中并不存在相应的框架,你可以这样:window.open(list[page],"_blank");这是指在新窗口中打开.

game15888 发表于 2008-4-7 15:46

我试试

game15888 发表于 2008-4-7 16:04

可以哦~!谢谢

页: [1]

编程论坛