报告错误:top.fset1.fset2.cols 不是对象

解决方案 »

  1.   

    这还不简单:onclick="fset2.cols='1,*';"
    如果不行就:onclick="parent.fset2.cols='1,*';"
      

  2.   

    top.asp:
    <input type="button" onclick="top.fset2.cols='1,*'">
      

  3.   

    TRY:
    t.htm
    <frameset id="fset1" rows="50,*" cols="*" framespacing="0" border="1"  frameborder="no" >
      <frame src="top.asp" name="top" frameborder="no" scrolling="no" noresize="noresize" marginwidth="0" marginheight="0" id="top" />
      <frameset id="fset2" rows="*" cols="188,*" framespacing="0" frameborder="no" border="0" bordercolor="#FFFFFF">
        <frame src="l.htm" id="left" name="left" />
        <frame src="main.asp" id="main" name="main" />
      </frameset>
    </frameset>l.htm
    <body bgcolor="buttonface" onclick="oc(top.fset2);">
    <script language="javascript">
    function oc(obj){
    var oldcol =  obj.cols;
    if(oldcol=="10,*"){
    obj.cols = "188,*";
    }else{
    obj.cols = "10,*";
    }
    }
    </script>
    </body>
      

  4.   

    index.htm:
    ###########################
    <html><head>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
    <title>隐藏框架</title>
    </head><frameset id="f1" rows="5%,*">
    <frame name="top" src="hideFrame.htm" target="_self">
    <frameset id="f2" cols="*,78%">
    <frame name="left" src="l.htm" marginwidth="1" marginheight="1" scrolling="no">
    <frame name="main" src="main.htm" target="_self">
    </frameset>
    <noframes>
    <body> <p>此网页使用了框架,但您的浏览器不支持框架。</p> </body>
    </noframes>
    </frameset></html>
    #########################################
    hideFrame.htm:
    ###############
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>隐藏框架</title>
    <base target="_self">
    <script language="javascript">
    function HideFrame(obj)
    { var theCols =  obj.cols;
    if(theCols=="0,*")
    { obj.cols = "150,*";
    }else
    { obj.cols = "0,*"; }
    }
    </script>
    </head><body bgcolor="buttonface" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
    <table border="1" width="100%" id="table1">
    <tr>
    <td align=center>
    <input type="button" value=" 单击隐藏左边的框架 " name="B3" onclick="HideFrame(top.f2);"></td>
    </tr>
    </table>
    </body></html>