这是我正在使用的当前代码:
<script type="text/javascript">
var win = window.open("URL...", "thePopUp", "");
var pollTimer = window.setInterval(function() {
if (win==null || win.closed !==false || navigator.appName=="Microsoft Internet Explorer"){
window.clearInterval(pollTimer);
pause();
alert("Oh No! Something has gone wrong, please check the requirements before continuing.");
}
}, 10);
</script>
这基本上在另一个窗口中打开一个页面,用户需要在该页面上打开以获得网站上的积分。显示的弹出窗口每20秒更改一次URL。
然而,当它们打开页面时会自动打开,我想使用一个按钮来启动上面的代码。但是当我尝试这个时,弹出窗口不会更改URL,除非他们再次按下按钮。
所以我所追求的是一种用按钮打开这个弹出窗口的方法,但之后不必一次又一次地使用该按钮,所以它不再通过按钮了。