页面很简单,如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
  <title>Complex Layout</title>
  
<script type="text/javascript"> 
window.setInterval(showalert, 3000);
function showalert()
{
alert("aaaaa");
}
</script> </head>
<body>
  <input type='file'>
</body>
</html>
在ie6,火狐等浏览器下,打开文件浏览窗口,定时器仍然会继续执行
但是在ie7,ie8下,打开文件浏览窗口,定时器就会暂停执行请问如何解决这个问题?谢谢

解决方案 »

  1.   

    规范问题吧 建议这样写
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns=" http://www.w3.org/1999/xhtml">
    <head>
      <title>Complex Layout</title>
      
    <script type="text/javascript"> 
        window.setInterval("showalert()", 3000);
        function showalert()
        {
            alert("aaaaa");
        }
    </script> </head>
    <body>
      <input type='file'>
    </body>
    </html>
      

  2.   

    呃,这个问题蛮奇怪的,关注一下。
    这应该跟IE7、IE8自身的window.setInterval的执行机制有关。