我有2个链接:
例如: www.baidu.com
http://t.sina.com.cn
上面2个链接。问题: 我要让这2个链接循环调用。第一次刷新页面 调用www.baidu.com 。等10秒后,再调用http://t.sina.com.cn等3分钟后调用 www.baidu.com 然后....就像上面循环...
谢谢
例如: www.baidu.com
http://t.sina.com.cn
上面2个链接。问题: 我要让这2个链接循环调用。第一次刷新页面 调用www.baidu.com 。等10秒后,再调用http://t.sina.com.cn等3分钟后调用 www.baidu.com 然后....就像上面循环...
谢谢
var links = [
{url : 'www.baidu.com' , time : 10000},
{url : 'http://t.sina.com.cn' , time : 1000*60*3}
];
var currentIndex = 0;
function change(isPostBack){
var time = links[currentIndex].time;
if(isPostBack){
time = 0;
}
setTimeout(function(){
/*切换*/
links[currentIndex].url;
++currentIndex;
if(currentIndex==links.length)
currentIndex = 0;
change(false);
} , time);
}
change(true);
本来就是2个不同的页面. // 定时刷新页面请求action
refresh = function timer()
{
window.location.href='${basePath}/measure/measureQuery.action';
};
//每一个小时刷新一次页面
window.setInterval(refresh,30000);上面就是一个定时器。 我只要他们在规定的时间调用对方 就行了。
<html>
<head>
<script src="a.js"></script>
<script>
window.onload = function(){
registerFresh("file:///C:/Users/CSS01/Desktop/新建文件夹/b.html",3000);
}
</script>
</head>
<body>
这是a页面
</body>
</html>b.html
<html>
<head>
<script src="a.js"></script>
<script>
window.onload = function(){
registerFresh("file:///C:/Users/CSS01/Desktop/新建文件夹/a.html",3000);
}
</script>
</head>
<body>
这是b页面
</body>
</html>a.js/**
*@url 想要跳转到的页面的绝对url
*@time 延迟的时间,单位毫秒
*/
var _NavigaterTarget;
function registerFresh(url,time){
_NavigaterTarget = url;
setTimeout("navigate2URL()",time);
}
function navigate2URL(){
window.location.href = _NavigaterTarget;
}
这种方式 看着可以. 但是不能用在我这里。 我一个页面链接是python 做的。 另外一个页面是java。 我只能操作java这个页面.
随便怎么刷新都可以。 为什么要这样做: 是因为, 一个页面是python做的页面。jsp 页面是8张生成的报表图形,需要循环显示。 项目要求把python的页面也循环加载到jsp中。 连同8张图片一起循环显示