在子窗口上显示警告消息后,在opener窗口中的settimeout不起作用

时间:2013-02-12 01:42:06

标签: javascript

我在iOS5之后在iPad上发现了safari中的错误,当子窗口显示警告消息(或确认和之前的启动)时,settimeout在开启窗口上运行停止。 当开启窗口再次聚焦时,是否可以继续设置超时?

谢谢!

>>opener page<<

<HEAD> 
<script>
var cnt_t = 0;
var t = function(){ document.getElementById("disp").innerHTML = ++cnt_t; console.log(Math.random());setTimeout(t,1000);};
setTimeout(t,1000);
function openwindow(){
            var path = "settimeout_child.html",param="";
            childWin = window.open(path, "", param);
}
</script>
</HEAD>
<BODY>
<input type="button" value="winopen" onclick = "openwindow()"/>

<div id="disp" style="font-size:100px"></div>
</BODY>



>>child page<<

<HEAD> 
 <script>
var cnt_t = 0;
var t = function(){document.getElementById("disp").innerHTML = ++cnt_t; console.log(Math.random());setTimeout(t,1000);};
setTimeout(t,1000);

</script>
</HEAD>
<BODY>

<input type="button" value="alert" onclick = "javascript:alert(1);"/>
<div id="disp" style="font-size:100px"></div>
</BODY>

0 个答案:

没有答案