无法从子窗口中访问父窗口的位置对象

文章编号: 314209 - 查看本文应用于的产品
展开全部 | 关闭全部

本页

症状

当 Microsoft Internet Explorer 6.0 中的子窗口在其父窗口中调用函数时,该函数可能无法访问 window.location DOM 对象,所有的对象属性和方法都可能停止响应(崩溃),并且您可能会收到以下错误:
Variable uses an automation type not supported by JScript

原因

发生此问题的原因是 Internet Explorer 6.0 中的一个变量在内部使用之前没有初始化。

解决方案

要解决此问题,请获取最新的 Internet Explorer 6 Service Pack。有关其他信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章:
328548 如何获取 Internet Explorer 6 的最新 Service Pack
该修复程序的英文版应具有以下或更新的文件属性:
日期         时间    版本         大小       文件名
-----------------------------------------------------------
07-Jan-2002  16:25 PM    6.00.2713.700  2,747,904  Mshtml.dll    
				

状态

Microsoft 已经确认这是 Microsoft Internet Explorer 6 中存在的问题。 此问题最早在 Internet Explorer 6 Service Pack 1 中得到了解决。

更多信息

有关为 Microsoft Internet Explorer 开发基于 Web 的解决方案的更多信息,请访问下面的 Microsoft Web 站点:
http://msdn.microsoft.com/workshop/entry.asp

http://msdn2.microsoft.com/en-us/ie/default.aspx

http://support.microsoft.com/iep

重现此问题的步骤

  1. 单击开始,指向程序,单击附件,然后单击记事本
  2. 复制并粘贴以下代码,然后将其保存为“Parent.htm”(不带引号):
    <HTML>
    <HEAD>
    <title>Parent Window</title>
    <script>
    function accessProp()
    {
      alert(location.protocol);
      alert(location.host);
      alert(location.hash);
      alert(location.href);
      alert(location.pathname);
      alert(location.port);
      alert(location.search);
      alert(location.hostname);
     
    }
    function accessFunc()
    {
      location.reload(true);
      location.assign("http://www.microsoft.com");
      location.replace("http://msdn.microsoft.com");
      location.toString()
    }
    </script>
    </HEAD>
     
    <BODY>
    <button onclick="window.open('child.htm', 'newwin', 'width=700,height=500')">Open a child window</button>
    </BODY>
    </HTML>
    					
  3. 单击开始,指向程序,单击附件,然后单击记事本
  4. Copy and paste the following code, and then save it as "Child.htm" (without quotation marks):
    <html>
    <head>
    <title>Child Window</title>
    </head>
    <body>
    <p>
    <center>
    <button onclick="window.opener.accessProp()">Get all the location properties from parent</button>
    <button onclick="window.opener.accessFunc()">Get all the location methods from parent</button>
    </center>
    </p>
    </body>
    </html>
    					
  5. 将 parent.htm 放以您的 Web 服务器上,并通过 http 从浏览器中访问它,如下所示:
    http://localhost/parent.htm
  6. 单击“打开子窗口”,child.htm 页面将在一个新 Internet Explorer 窗口中打开。
  7. 单击 child.htm 页面中的“从父级获取所有位置属性”或“从父级获取所有位置方法”,您将收到本文“症状”一节提及的错误信息。
该修复程序仅适用于其中的 Mshtml.dll 文件版本低于 6.00.2713.700 的 Internet Explorer 6.0 版本。该修复程序包含在 2000 年 2 月 11 日版 Internet Explorer 累积安全修补程序和更高版本的累积安全修补程序中。有关 2000 年 2 月 11 日版 Internet Explorer 累积安全修补程序的其他信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章:
316059 MS02-005:2002 年 2 月 11 日版 Internet Explorer 累积修补程序

属性

文章编号: 314209 - 最后修改: 2008年1月30日 - 修订: 5.0
这篇文章中的信息适用于:
  • Microsoft Internet Explorer 6.0?当用于
    • Microsoft Windows XP Home Edition
    • Microsoft Windows XP Professional
    • Microsoft Windows XP Media Center Edition
    • Microsoft Windows XP Tablet PC Edition
    • Microsoft Windows 2000 Advanced Server
    • Microsoft Windows 2000 Datacenter Server
    • Microsoft Windows 2000 Professional Edition
    • Microsoft Windows 2000 Server
    • Microsoft Windows NT Server 4.0 Standard Edition
    • Microsoft Windows NT Server 4.0, Terminal Server Edition
    • Microsoft Windows NT Workstation 4.0 Developer Edition
    • Microsoft Windows 98 Second Edition
    • Microsoft Windows 98 Standard Edition
关键字:?
kbbug kbfix kbie600presp1fix KB314209
Microsoft和/或其各供应商对于为任何目的而在本服务器上发布的文件及有关图形所含信息的适用性,不作任何声明。 所有该等文件及有关图形均"依样"提供,而不带任何性质的保证。Microsoft和/或其各供应商特此声明,对所有与该等信息有关的保证和条件不负任何责任,该等保证和条件包括关于适销性、符合特定用途、所有权和非侵权的所有默示保证和条件。在任何情况下,在由于使用或运行本服务器上的信息所引起的或与该等使用或运行有关的诉讼中,Microsoft和/或其各供应商就因丧失使用、数据或利润所导致的任何特别的、间接的、衍生性的损害或任何因使用而丧失所导致的之损害、数据或利润不负任何责任。

提供反馈