• frame间的层级调用,如何支持firefox


    碰到这样的问题,
    我有一个页面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
     
  • 相关阅读:
    SSM框架整合步骤
    Spring-data-jpa
    allure定制报告
    pytest常用选项
    staticmethod&classmethod&property
    __slot__
    python的参数传递
    闭包和装饰器
    内置高阶函数
    str
  • 原文地址:https://www.cnblogs.com/wangsu/p/1232907.html
Copyright © 2020-2023  润新知