我有两个htm文件,下面是Main.htm的源码:
<html>
<head>
<title>主框架</title>
<meta http-equiv=content-type content="text/html;charset=gb2312">
</head>
<frameset border="0" framespacing="0" rows="51,*,0,0" frameBorder="0">
<frame id="daoHangTiao" name="daoHangTiao" src="daoHangTiao.htm" frameBorder="0" noResize scrolling="no">
<frameset border="0" name="main" frameSpacing="1" frameBorder="0" cols="503,*" scrolling="auto">
<frame id="leftFrame" border="0" name="leftFrame" marginWidth="0" frameSpacing="0" marginHeight="0" src="leftFrame.htm" frameBorder="0" scrolling="no">
<frame id="right" border="0" name="right" frameSpacing="0" src="rightIndex.htm" frameBorder="0">
</frameset>
<frame border="0" name="online" frameSpacing="0" src="online.htm" frameBorder="0" noResize scrolling="no">
<frame border="0" name="function" frameSpacing="0" src="function.htm" frameBorder="0" noResize scrolling="no">
</frameset>
</html>
以下是 leftFrame.htm 的源码:
<html>
<head>
<title>leftFrame</title>
<script language=javascript>
function changeWin(){
if(parent.main.cols!='0,*' && parent.main.cols!='5,*'){
parent.main.cols='5,*';
ImgArrow.src="bl_1.gif";
}else{
parent.main.cols='503,*';
ImgArrow.src="al_1.gif";
}
}
</script>
<meta http-equiv=content-type content="text/html;charset=gb2312">
</head>
<body bgColor="#8d989a" leftMargin="0" topMargin="0">
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tbody>
<tr>
<td width="100%">
<iframe id="leftiframe" style="VISIBILITY:inherit;WIDTH:100%;HEIGHT:100%" name="leftiframe" src="leftMain.htm" frameBorder="0">
</iframe>
</td>
<td bgColor="#d0d0c8">
<table id="td1" height="100%" cellSpacing="0" cellPadding="0" width="100%" bgColor="#d7d8da border="0">
<tbody>
<tr>
<td title="拖动以调整宽度" height="50%">
</td>
</tr>
<tr>
<td height="96">
<img id=ImgArrow οnclick=changeWin() alt="展开/关闭帖子列表" src="al_1.gif" width="5" border="0" name="ImgArrow" style="currsor:hand">
</td>
</tr>
<tr>
<td title="拖动以调整宽度" height="50%">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
另外,我还有两个gif图片(就是一个向右的三角箭头与向左的三角箭头,也可以自己PS两个),下载地址如下:
http://txt.mop.com/dzh/centerframe/al_1.gif
http://txt.mop.com/dzh/centerframe/bl_1.gif
将上面四个文件放在同一目录下,即可正常运行Main.htm查看出框架折叠的效果!