top.frames没有在Firefox
问题描述:
我用两个iframes
我 页面父页面工作有iframe
说id = grandparent , src = "child.html".
top.frames没有在Firefox
和child.html我设置一些变量,也有在孩子iframe
.HTML说
id = parent, src="grandchild.html"
和grandchild.html我使用JavaScript的
var value = top.frames['grandparent']
01访问在child.html变量
它是工作在铬罚款,但在Firefox不工作与变量的值,意味着我无法访问child.html的变量
请帮助
答
Firefox的行为是一个规范要求。见http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#dom-window-nameditem-filter并在http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#the-iframe-element
WebKit的浏览器上下文名称的规则有一个已知的bug(见https://bugs.webkit.org/show_bug.cgi?id=11388),它原来的iframe的ID到里面的窗口的名称。
对于您的情况,您只是想在相关的iframe上使用name="grandparent"
。
我也面临同样的问题。你的解决方案帮了我。谢谢。 – MIM 2013-09-05 09:42:13