Home > Web Front-end > JS Tutorial > body text

How to solve the problem that frameset cannot hide the left column in Google Chrome?

青灯夜游
Release: 2018-10-25 16:10:34
forward
3027 people have browsed it

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>
Copy after login
switchBar.html 页面中,可以使用js 控制左边栏的显示、隐藏
Copy after login
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,*";
            }
        }
Copy after login
<p id="oa_tree" onclick="oa_tool();" title="隐藏工具栏"><br>
         <img id="frameshow" src="p_1.gif">
</p>
Copy after login

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>
Copy after login

Frameset Add ID, use document.getElementById in JS to get the cols of ID

if (parent.document.getElementById(&#39;mainDefine&#39;).cols == "0,10,*") {
       frameshow.src = "p_1.gif";
       oa_tree.title = "隐藏工具栏"
       parent.document.getElementById(&#39;mainDefine&#39;).cols = "200,10,*";
}
else {
     frameshow.src = "p_2.gif";
     oa_tree.title = "显示工具栏"
     parent.document.getElementById(&#39;mainDefine&#39;).cols = "0,10,*";
}
Copy after login

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!

Related labels:
source:cnblogs.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template