window.parent.frames 不适用于 Firefox
window.parent.frames don't work in Firefox
alert(window.parent.frames.toolbar.location)
警报在 Firefox 中未定义,IE 工作正常。
使用这个
alert(window.parent.frames[0].toolbar.location);
应该可以。
正如我的评论所说。 window.frames
是包含 window
中所有帧的列表。您需要 select 正确的 window,我猜这是索引 0
.
在 Chrome 和 FF 中,如果 toolbar
是 id
或 (i)frame
的 name
,则存在差异。 .frames.id
将引用一个实际的 (i)frame 元素(没有 location
属性),.frames.name
引用一个 (i) 中的 window
) 框架元素。在 IE 中都指的是 (i)frame 中的 window
。
一个快速修复方法是仅向您的 (i)frame 元素添加 also/use name="toolbar"
属性。
alert(window.parent.frames.toolbar.location)
警报在 Firefox 中未定义,IE 工作正常。
使用这个
alert(window.parent.frames[0].toolbar.location);
应该可以。
正如我的评论所说。 window.frames
是包含 window
中所有帧的列表。您需要 select 正确的 window,我猜这是索引 0
.
在 Chrome 和 FF 中,如果 toolbar
是 id
或 (i)frame
的 name
,则存在差异。 .frames.id
将引用一个实际的 (i)frame 元素(没有 location
属性),.frames.name
引用一个 (i) 中的 window
) 框架元素。在 IE 中都指的是 (i)frame 中的 window
。
一个快速修复方法是仅向您的 (i)frame 元素添加 also/use name="toolbar"
属性。