The content of this article is to introduce the method to solve the problem of frameset being unable to hide the left column in Google Chrome. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Using the Frameset framework, I found that under IE,
<frameset name="mainDefine" cols="200,10,*" frameborder="NO" border="0" framespacing="0" rows="*"> <frame name="LeftFrame" noresize scrolling="auto" src="<%= PageTitle %>" > <frame name="middleFrame" scrolling="NO" noresize src="switchBar.html"> <frame name="mainFrame" id ="mainFrame" scrolling="auto" noresize src="AddTabs.aspx"> </frameset>
switchBar.html 页面中,可以使用js 控制左边栏的显示、隐藏
function oa_tool() { if (window.parent.mainDefine.cols == "0,10,*") { frameshow.src = "p_1.gif"; oa_tree.title = "隐藏工具栏" window.parent.mainDefine.cols = "200,10,*"; } else { frameshow.src = "p_2.gif"; oa_tree.title = "显示工具栏" window.parent.mainDefine.cols = "0,10,*"; } }
<p id="oa_tree" onclick="oa_tool();" title="隐藏工具栏"><br> <img id="frameshow" src="p_1.gif"> </p>
but in Google Chrome, an error will be reported:
Cannot be read cols attribute.
Solution:
<frameset id="mainDefine" name="mainDefine" cols="200,10,*" frameborder="NO" border="0" framespacing="0" rows="*"> <frame name="LeftFrame" noresize scrolling="auto" src="<%= PageTitle %>" > <frame name="middleFrame" scrolling="NO" noresize src="switchBar.html"> <frame name="mainFrame" id ="mainFrame" scrolling="auto" noresize src="AddTabs.aspx"> </frameset>
Frameset Add ID, use document.getElementById in JS to get the cols of ID
if (parent.document.getElementById('mainDefine').cols == "0,10,*") { frameshow.src = "p_1.gif"; oa_tree.title = "隐藏工具栏" parent.document.getElementById('mainDefine').cols = "200,10,*"; } else { frameshow.src = "p_2.gif"; oa_tree.title = "显示工具栏" parent.document.getElementById('mainDefine').cols = "0,10,*"; }
The above is the detailed content of How to solve the problem that frameset cannot hide the left column in Google Chrome?. For more information, please follow other related articles on the PHP Chinese website!