asp.net隐藏左导航栏菜单

这篇博客介绍了如何在ASP.NET的网页中通过JavaScript和CSS实现左导航菜单的隐藏与显示功能。内容包括两个关键页面Default.aspx和menuswitch.aspx的代码展示,以及JavaScript函数oa_tool()的详细解释,该函数根据用户操作改变frameset的列宽,从而达到切换导航栏显示状态的效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Default.aspx页面代码:
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>

<frameset rows="80,*" cols="*" frameborder="0" border="0" framespacing="0">
  <frame src="top.aspx" name="topFrame" scrolling="NO" noresize >
  <frameset rows="*" cols="168,*" framespacing="0" frameborder="NO" border="0" id=oa_frame><!--这里的id名称要与menuswitch.aspx页面的oa_frame对应-->
    <frame src="left.aspx" name="leftFrame" scrolling="auto" MARGINWIDTH=0 MARGINHEIGHT=0 noresize>
    <frame name=middleframe src='menuswitch.aspx' scrolling='NO' frameborder='0' noresize>

    <frame src="main.aspx" name="mainFrame">
  </frameset>
</frameset>

<body>

</body>
</html>

menuswitch.aspx页面代码:
<style type="text/css">
<!--
body {
 margin-left: 0px;
 margin-top: 0px;
 margin-right: 0px;
 margin-bottom: 0px;
}
-->
</style>
<link href="Css/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style3 {FONT-SIZE: 12px
}
.style1 {color: #FFFFFF}
-->
</style>
<script>
function oa_tool(){
if(window.parent.oa_frame.cols=="0,8,*"){
frameshow.src="images/index_06.jpg";
oa_tree.title="隐藏工具栏"
window.parent.oa_frame.cols="137,8,*";
}
else{
frameshow.src="images/index_07.jpg";
oa_tree.title="显示工具栏"
window.parent.oa_frame.cols="0,8,*";}
}
</script>
<table height="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td width="8" bgcolor="#C0D5F4"> <div id=oa_tree onclick="oa_tool();" title=隐藏工具栏><a href="#"><img id=frameshow src="images/index_06.jpg" width="8" height="50" border="0"></a></div></td></tr></table>

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值