window.parent.frames在Firefox中不起作用 [英] window.parent.frames don't work in Firefox

查看:905
本文介绍了window.parent.frames在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  alert(window.parent.frames.toolbar.location)



在Chrome和FF中,如果<$>

c $ c> toolbar 是 id 名称 $ C>(I)帧。 .frames.id 将引用一个实际的(i)框架元素(它没有 location 属性), .frames.name 引用(i)框架元素中的窗口。在IE中,都是指在(i)框架内的窗口

快速修复也可以添加/只使用名称=工具栏属性到您的(i)框架元素。


alert(window.parent.frames.toolbar.location)

the alert is undefined in Firefox, IE it work fine.

解决方案

In Chrome and FF there's a difference if toolbar is either an id or a name of an (i)frame. .frames.id will refer to an actual (i)frame element (which doesn't have location property), .frames.name refers to the window within an (i)frame element. In IE both refer to the window within (i)frame.

A quick-fix would be to add also/use only name="toolbar" attribute to your (i)frame element.

这篇关于window.parent.frames在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆