隐藏左边导航栏(树形菜单)的例子
由四个文件构成
main.html,使用了框架的主界面;
left.html,被隐藏的页面;
right_frame.html,控制文件,使用了IFRAME嵌入right.html
right.html,需要全屏显示的页面。
main.html
<script>
document.write("<frameset name='forum' cols='150,*' frameborder='NO' border='0' framespacing='0'>");
document.write("<frame src='left.html' name='LeftFrame' scrolling='auto'>");
document.write("<frame src='right_frame.html' name='SwitchFrame' scrolling='auto'>");
document.write("</frameset>");
</script>
left.html
任意
right.html
任意
right_frame.html(最关键的文件)
<HTML>
<HEAD>
<TITLE>TOM 论坛</TITLE>
<META http-equiv=content-type content="text/html; charset=gb2312">
<STYLE type=text/css>
.point{position:absolute;background-color:#dddddd;font-size:12px;cursor:hand;}
</STYLE>
<SCRIPT language=j avascript>
var ua = window.navigator.userAgent;
var opera = /opera [56789]|opera/[56789]/i.test(ua);
var ie = !opera && /msie [56789]/i.test(ua);
var moz = !opera && /mozilla/[56789]/i.test(ua);
function changeWin(o){
if(!ie) return false;
if(parent.forum.cols != "2,*") {
parent.forum.cols = "2,*";
o.innerHTML = "<font face='Webdings' color='#000000' class='point'>4</font>";
} else {
parent.forum.cols = "150,*";
o.innerHTML = "<font face='Webdings' color='#000000' class='point'>3</font>";
}
}
</SCRIPT>
</HEAD>
<BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TR>
<TD bgColor=#aaaaaa><IMG height=1 src="/images/3.0/old/shim.gif" width=1></TD>
<TD bgColor=#dddddd>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TR>
<TD onclick=changeWin() height=1><IMG height=1 src="/images/3.0/old/shim.gif" width=10></TD></TR>
<TR>
<TD id="menuSwitch" onclick="changeWin(this)" height="100%"><FONT face="Webdings" color="#000000" class="point">3</FONT></TD>
</TR>
</TABLE>
</TD>
<TD width="100%">
<IFRAME style="VISIBILITY: inherit; WIDTH: 100%; HEIGHT: 100%" marginWidth=0 frameSpacing=0 marginHeight=0 src="right.html" frameBorder=0></IFRAME>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>