欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

有关parent.frame.cols在firefox浏览器上不兼容的问题解决

程序员文章站 2022-04-10 14:55:32
...

IE(不兼容FireFox):

if(parent.myFrame.cols == "199,7,*") {
        parent.myFrame.cols="0,7,*";
        document.getElementById("ImgArrow").src="images/switch_right.gif";
        document.getElementById("ImgArrow").alt="打开左侧导航栏";
    } else {
        parent.myFrame.cols="199,7,*";
        document.getElementById("ImgArrow").src="images/switch_left.gif";
        document.getElementById("ImgArrow").alt="隐藏左侧导航栏";
    }

二者都兼容:

if(window.parent.document.getElementById("myFrame").cols == "199,7,*") {
    window.parent.document.getElementById("myFrame").cols ="0,7,*";
    document.getElementById("ImgArrow").src="images/switch_right.gif";
    document.getElementById("ImgArrow").alt="打开左侧导航栏";
    } else {
        window.parent.document.getElementById("myFrame").cols="199,7,*";
        document.getElementById("ImgArrow").src="images/switch_left.gif";
        document.getElementById("ImgArrow").alt="隐藏左侧导航栏";
    }

 

 

转载于:https://my.oschina.net/garyun/blog/602817