Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/443.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaScript-IE8 window.onload()在新打开的窗口中不起作用_Javascript_Internet Explorer 8_Window.open - Fatal编程技术网

JavaScript-IE8 window.onload()在新打开的窗口中不起作用

JavaScript-IE8 window.onload()在新打开的窗口中不起作用,javascript,internet-explorer-8,window.open,Javascript,Internet Explorer 8,Window.open,这篇文章是关于 在主页(窗口)中,我打开一个新窗口: ... window.open('foobar.php',<...>); ... 。。。window.open('foobar.php',)。。。 新窗口已正确打开,但window.onload()部分(位于'foobar.php'中)中的代码未执行: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w

这篇文章是关于

在主页(窗口)中,我打开一个新窗口:

... window.open('foobar.php',<...>); ...
。。。window.open('foobar.php',)。。。
新窗口已正确打开,但window.onload()部分(位于'foobar.php'中)中的代码未执行:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <title>foobar</title>
   <script type="text/javascript">
   //<![CDATA[
   window.onload = function ()
   {
      alert('foobar');
   }
   //]]>
   </script>
</head>
<body>
</body>
</html>

福巴
//
将“window.onload”替换为原型的“document.observe('dom:load',function()”和“onload”body标记中的属性也不起作用。如果重新加载新打开窗口的内容或再次打开它,则代码工作正常。如果从主窗口中运行代码,则代码工作正常。这似乎是缓存问题,但我不确定

我的IE版本是8.0.6001.18702。我已经推迟了所有附加组件


非常感谢

由于脚本位于已加载的页面中,因此onload事件发生在很久以前


加载窗口的时间与DOM准备就绪的时间之间存在差异。

很抱歉,这有点不清楚。window.open('foobar.php');上面的代码位于'foobar.php'。请发布
窗口的确切代码。open