gpt4 book ai didi

javascript - window.close 没有关闭窗口

转载 作者:行者123 更新时间:2023-12-03 12:05:07 26 4
gpt4 key购买 nike

我尝试每 5 分钟后打开一个新的浏览器窗口,在此之前,如果有浏览器,我将关闭 窗口已经打开了..但是 window.close 似乎没有关闭..

<html>

<head>
<script>
function mytimeout() {

window.open("http://www.starsports.com/ssplus/cricket/index.html?v=1344487");
window.setInterval(myFunc, 310000);
}

function myFunc() {


window.close();

window.open("http://www.starsports.com/ssplus/cricket/index.html?v=1344487");

}
</script>
</head>

<body onload="mytimeout()">
</body>

</html>

最佳答案

<html>

<head>
<script>

var mywindow;

function mytimeout() {

mywindow = window.open("http://www.starsports.com/ssplus/cricket/index.html?v=1344487");
window.setInterval(myFunc, 310000);
}

function myFunc() {


mywindow.close();

mywindow = window.open("http://www.starsports.com/ssplus/cricket/index.html?v=1344487");

}
</script>
</head>

<body onload="mytimeout()">
</body>

</html>

关于javascript - window.close 没有关闭窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25220498/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com