ASP.NET 2.0,写无限级下拉菜单不再难!!

来源:互联网 发布:ubuntu 学打字 编辑:程序博客网 时间:2024/06/05 05:01
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

ASP.NET 2.0提供了一个Menu 类,可以方便地创建水平或者垂直方向的下拉菜单,下面就是一个例子:

NET_lover/1871/r_menu.gif" target="_blank">查看例子

 

<%@ Page Language="C#" %><html><!-- ASP.NET 2.0的例子  --><head runat="server"></head>

<body><form runat="server">

<h3>下拉菜单的例子</h3>

<!-- Use declarative syntax to create the   --><!-- menu structure. Submenu items are      --><!-- created by nesting them in parent menu --><!-- items.                                 --><ASP:menu id="NavigationMenu"  disappearafter="2000"  staticdisplaylevels="2"  staticsubmenuindent="10"   orientation="Horizontal"  font-names="Arial"   target="_blank"    runat="server">    <staticmenuitemstyle backcolor="#DDDDDD"    forecolor="red"/>  <statichoverstyle backcolor="#DDDDDD"/>  <dynamicmenuitemstyle backcolor="#EEEEEE"    forecolor="red"/>  <dynamichoverstyle backcolor="#DDDDDD"    forecolor="Black"/>

  <items>    <ASP:menuitem navigateurl="NET.ASPx.cc/">http://dotNET.ASPx.cc/"       text="首页"      tooltip="首页">      <ASP:menuitem navigateurl="NET.ASPx.cc/ShowList.ASPx?id=1">http://dotNET.ASPx.cc/ShowList.ASPx?id=1"        text="ASP.NET 栏目"        tooltip="ASP.NET 栏目">        <ASP:menuitem navigateurl="Classical.ASPx"           text="ASP.NET 最新文章"          tooltip="ASP.NET 最新文章"/>        <ASP:menuitem navigateurl="Rock.ASPx"          text="ASP.NET 问与答"          tooltip="ASP.NET 问与答">          <ASP:menuitem navigateurl="Classical.ASPx"           text="ASP.NET 最新文章"          tooltip="ASP.NET 最新文章"/>          <ASP:menuitem navigateurl="Classical.ASPx"           text="ASP.NET 最新文章"          tooltip="ASP.NET 最新文章"/>          </ASP:menuitem>        <ASP:menuitem navigateurl="Jazz.ASPx"          text="Jazz"          tooltip="Jazz"/>      </ASP:menuitem>      <ASP:menuitem navigateurl="Movies.ASPx"        text="Movies"        tooltip="Movies">        <ASP:menuitem navigateurl="Action.ASPx"          text="Action"          tooltip="Action">          <ASP:menuitem navigateurl="Drama.ASPx"          text="Drama"          tooltip="Drama"/>          </ASP:menuitem>        <ASP:menuitem navigateurl="Drama.ASPx"          text="Drama"          tooltip="Drama"/>        <ASP:menuitem navigateurl="Musical.ASPx"          text="Musical"          tooltip="Musical"/>      </ASP:menuitem>    </ASP:menuitem>  </items>      </ASP:menu></form></body></html>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击