Javascript打开一个新页面(一个或多个),等待加载,然后关闭它
我正在编写一个应用程序,可以在特定的时间间隔内在网站上运行线程。应用程序查看多个输入框,如果每个输入框中都有值,则会执行window.open命令来加载页面。然后关闭页面。我遇到的问题是,我看不到任何方法在每次执行后暂停for循环,因此页面在关闭之前不会实际加载。有什么想法吗?这是代码Javascript打开一个新页面(一个或多个),等待加载,然后关闭它,javascript,arrays,Javascript,Arrays,我正在编写一个应用程序,可以在特定的时间间隔内在网站上运行线程。应用程序查看多个输入框,如果每个输入框中都有值,则会执行window.open命令来加载页面。然后关闭页面。我遇到的问题是,我看不到任何方法在每次执行后暂停for循环,因此页面在关闭之前不会实际加载。有什么想法吗?这是代码 <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" />
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Reoccuring Open</title>
</head>
<body>
<input id="Bump0" type="text" /><br />
<input id="Bump1" type="text" /><br />
<input id="Bump2" type="text" /><br />
<input id="Bump3" type="text" /><br />
<input id="Bump4" type="text" /><br />
<input id="Bump5" type="text" /><br />
<input id="Bump6" type="text" /><br />
<input id="Bump7" type="text" /><br />
<input type="button" id="btnStartReoccure" value="Start" onclick="fncSetInterval()"/> <br />
<br />
If Checked will continue to run<input type="checkbox" id="chxReoccure" />
</body>
</html>
<script type="text/javascript">
function fncSetInterval() {
//alert("Set interval x " + x);
i = 14410000; // 4 hours and some extra
var bumpsValue = new Array;
for (x = 0; x < 8; x++)
{
if (document.getElementById("Bump" + x).value == null || document.getElementById("Bump" + x).value == "") {
break;
}
bumpsValue[x] = document.getElementById("Bump" + x).value;
window[x] = window.open("http://www.somewebpage.com/bump.php?t=" + bumpsValue[x]);
}
window.setInterval(function(){fncRunReOccur()},i);
}
function fncRunReOccur() {
//var RecURL = document.getElementById("ReoccuranceURL").value;
//alert("(document.getElementById.value " + (document.getElementById("chxReoccure").checked));
if (document.getElementById("chxReoccure").checked == true) {
}
}
function fncSleep(millis, callback) {
setTimeout(function ()
{ callback(); }
, millis);
}
</script>
一个脚本,以碰撞论坛线程?我非常不喜欢这个概念。有很多人会不喜欢这个概念。不管讨厌与否,有人知道如何让它发挥作用吗?我可以编写另一个完整的函数,再等几分钟,然后关闭打开的窗口,但我想知道是否有人有办法让它按原样工作。没有jquery:。