Author: DotSharp
We can see the function of the navigation bar in the upper left corner of the CSDN forum. Let's simulate this function and use JS to make a simple non-refresh left navigation bar hiding function in asp.net.
First, make a frame Page, we name it main.aspx
<!-- main.aspx main code-->
<script>
document.write("<frameset rows='54,28,*,19' frameborder='NO' border='0' framepacing='0'>");
document.write("<frame src='title.aspx' name='topFrame' scrolling='NO' noresize>");
document.write("<frame src='bar.aspx' name='MainNaviFrame' scrolling='NO'>");
<!-- left.aspx is the navigation page, menuswitch.aspx is the interactive button page-->
document.write("<frameset name='forum' cols='150,8,*' frameborder='NO' border='0' framepacing='0'>");
document.write("<frame src='left.aspx' name='LeftFrame' scrolling='auto'>");
document.write("<frame src='menuswitch.aspx' name='SwichFrame' scrolling='No'>");
document.write("<frameset rows='100%,*' frameborder='NO' border= '0' framepacing='0'>");
document.write("<frame src='' name='MainFrame' scrolling='no'>");
document.write("</frameset></frameset>");
document.write("<frame src='bottom.aspx' name='BottomFrame' scrolling='No'></frameset>");
</script>
<!-- menuswitch.js main code -->
var leftwin = true;
function changeWin()
{
if(leftwin == true)
{
parent.forum.cols = "0,8,*";
parent.SwichFrame.menuSwitch.innerHTML = "<a onclick='changeWin();' style='cursor:hand;'><img src='images/ArrowOpen.gif' border='0'></a>" ;
leftwin = false;
}
else
{
parent.forum.cols = "150,8,*";
parent.SwichFrame.menuSwitch.innerHTML = "<a onclick='changeWin();' style='cursor:hand;'><img src='images/ArrowClose.gif' border='0'></a>" ;
leftwin = true;
}
}
<!-- menuswitch.aspx main code -->
<table height="100%" cellSpacing="0" cellPadding="0" width="8" background="images/MiddleBg1.gif"
border="0">
<tr>
<td onclick="changeWin();" style="cursor:hand;" id="menuSwitch" align="center">
<img id="Image1" src="images/ArrowClose.gif" border="0" />
</td>
</tr>
</table>
The above functions are not perfect and can only serve as a guide. Netizens are welcome to communicate with me.