Home >Web Front-end >HTML Tutorial >The problem with iframeset nesting: one layer of iframeset can be expanded and closed, but adding another layer cannot_html/css_WEB-ITnose

The problem with iframeset nesting: one layer of iframeset can be expanded and closed, but adding another layer cannot_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 12:14:521452browse

First code:

<html><head></head><FRAMESET rows="90,*" frameSpacing=0  frameBorder=no border=0 id=index>	<FRAME id=topFrame name=topFrame src="../index/admin_top.jsp" noResize scrolling=no>		<FRAMESET border=0 frameSpacing=0 id=colsIndex frameBorder=no cols=250,11,*>			<FRAME marginheight= "0"   marginwidth= "0" id=leftFrame name=leftFrame src="../index/left.jsp" noResize scrolling=no>                                           <FRAME src="../index/middle.jsp"  name=middleFrame scrolling=no noResize id=middleFrame>             	         <FRAMESET border=0 frameSpacing=0 id=colsIndexSon frameBorder=no rows=250,*>                		       <FRAME id=selectFrame name=selectFrame  marginheight= "1"   marginwidth= "1" src="../index/select.jsp" scrolling=no>             					       <FRAME marginheight= "1"   marginwidth= "1" id=mainFrame name=mainFrame					src="../jump.do?type=city_city" scrolling=no>		         </FRAMESET>			</FRAMESET></FRAMESET>	<body></body></html>


How can I click on middleFrame to show and hide leftFrame?

The following JS is OK when there is only one iframeset, but after adding colsIndexSon it has no effect
function isShowNav(){alert(window.parent.colsIndex.cols);	if(window.parent.colsIndex.cols == "250,11,*"){		window.parent.colsIndex.cols = "0,11,*";	}else{		window.parent.colsIndex.cols = "250,11,*";	}}


Reply to the discussion (solution)

To add a layer, you need to add a parent
such as window.parent.parent

With your structure, there is no problem in operating colsIndex frameset from middleFrame. I have tested it here. However, it cannot be used by non-IE browsers because colsIndex cannot be obtained that way

    function isShowNav() {        var colsIndex = parent.document.getElementById('colsIndex');        alert(colsIndex.cols);        if (colsIndex.cols == "250,11,*") {            colsIndex.cols = "0,11,*";        } else {            colsIndex.cols = "250,11,*";        }    }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn