实现框架隐藏

来源:互联网 发布:搞笑网络流行语 编辑:程序博客网 时间:2024/06/05 05:01

index.html
---------------------------------------------
<html>
   <head>
 <title>My FrameSet</title>
 <meta http-equiv="Content-type" content="text/html; charset=GB2312">
 <meta http-equiv="content-Style-Type" content="text/css">
   </head>
   <frameset rows="10%,*">
        <frame id="top" src=top.html scrolling=no>
        <frameset id="main" cols="20%,*" framespacing="0" frameborder="1">
    <frame src="webform1.aspx" name="frmLeft" Scrolling="auto">
    <frame src="webform2.aspx" name="frmMain" Scrolling="No">
 </frameset>
   </frameset>
</html>

top.html
---------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script language=javascript>
  var bFlag = true;
  function adjust() {
      if(bFlag)
 window.parent.frames["main"].setAttribute("cols","*,100%");
      else
 window.parent.frames["main"].setAttribute("cols","20%,80%");
      bFlag = !bFlag;
  }
</script>
</head>
<body bgcolor=#cccccc>
   <table>
      <tr>
        <td>
          <input type=button value="Adjust frame" onclick="adjust()" style="width:100px;height:30px">
        </td>
      </tr>
   </table>
</body>
</html>