作者:DotSharp
我們在CSDN論壇上的左上角能夠看到導航欄的功能,下面就模擬該功能,利用JS在asp.net中作一個簡單的無刷新的左導航欄隱藏功能.
document.write("<frameset rows='100%,*' frameborder='NO' border='0' framespacing='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 主要代碼-->
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 主要代碼 -->
<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>
以上功能并不完善,只能起到拋磚引玉的作用,歡迎網友與我交流.
新聞熱點
疑難解答