熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ASP.NET 2.0寫無限級下拉菜單

2022-06-13   來源: .NET編程 

  ASPNET 提供了一個Menu 類可以方便地創建水平或者垂直方向的下拉菜單下面就是一個例子

  

  

  <%@ Page Language=C# %>
<html>
<! ASPNET 的例子  >
<head runat=server>
</head>

  <body>
<form runat=server>

  <h>下拉菜單的例子</h>

  <! Use declarative syntax to create the   >
<! menu structure Submenu items are      >
<! created by nesting them in parent menu >
<! items                                 >
<asp:menu id=NavigationMenu
  disappearafter=
  staticdisplaylevels=
  staticsubmenuindent=
  orientation=Horizontal
  fontnames=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=/
      text=首頁
       tooltip=首頁>
      <asp:menuitem navigateurl=/ShowListaspx?id=
        text=ASPNET 欄目
        tooltip=ASPNET 欄目>
        <asp:menuitem navigateurl=Classicalaspx
          text=ASPNET 最新文章
          tooltip=ASPNET 最新文章/>
        <asp:menuitem navigateurl=Rockaspx
          text=ASPNET 問與答
          tooltip=ASPNET 問與答>
          <asp:menuitem navigateurl=Classicalaspx
          text=ASPNET 最新文章
          tooltip=ASPNET 最新文章/>
          <asp:menuitem navigateurl=Classicalaspx
          text=ASPNET 最新文章
          tooltip=ASPNET 最新文章/>
          </asp:menuitem>
        <asp:menuitem navigateurl=Jazzaspx
          text=Jazz
          tooltip=Jazz/>
      </asp:menuitem>
      <asp:menuitem navigateurl=Moviesaspx
        text=Movies
        tooltip=Movies>
        <asp:menuitem navigateurl=Actionaspx
          text=Action
          tooltip=Action>
          <asp:menuitem navigateurl=Dramaaspx
          text=Drama
          tooltip=Drama/>
          </asp:menuitem>
        <asp:menuitem navigateurl=Dramaaspx
          text=Drama
          tooltip=Drama/>
        <asp:menuitem navigateurl=Musicalaspx
          text=Musical
          tooltip=Musical/>
      </asp:menuitem>
    </asp:menuitem>
  </items>     
</asp:menu>
</form>
</body>
</html>


From:http://tw.wingwit.com/Article/program/net/201311/12984.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.