碰到这样的问题,
我有一个页面main.html,里面有很多的frame,比如说a.html,b.html,c.html,d.html,e.html。。。
这些子页面,里面都有一个同名javascript的MenuButtonClass()方法
在其中一个子页面中,我会处理其它的frame是,一般会这样写
window.parent.frames(x).MenuButtonClass();
这个代码在IE中是没有任何问题的,可是在firefox是错误的!
后来我这样写了
window.parent.document.getElementsByTagName("frame")[x].MenuButtonClass();
但是仍然错误,为什么?我调式了,发现
window.parent.document.getElementsByTagName("frame")[x]是有对象的
难道还没有其它的东西没写?
今天终于找到原因了,原来少个contentWindow属性
所以上面应该这样写
window.parent.document.getElementsByTagName("frame")[x].contentWindow.MenuButtonClass();
这样的话,支持IE和firefox就没有问题了。
附上示例代码
窗体间访问的例子.rar
相关文章:
-
2022-12-23
-
2022-03-06
-
2022-02-12
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-01-09
猜你喜欢
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2021-10-03
-
2021-05-31
-
2022-12-23
-
2022-12-23
相关资源
-
下载
2023-02-17
-
下载
2021-06-05
-
下载
2021-06-24
-
下载
2022-12-10