語言

Menu.SkipLinkText 屬性

定義

取得或設定螢幕閱讀器閱讀隱藏圖片的替代文字,以便跳過連結列表。

public:
 property System::String ^ SkipLinkText { System::String ^ get(); void set(System::String ^ value); };
public string SkipLinkText { get; set; }
member this.SkipLinkText : string with get, set
Public Property SkipLinkText As String

屬性值

螢幕閱讀器讀取隱藏圖片的替代文字,提供跳過連結列表的能力。 預設為空字串(“”),表示此屬性未被設定。

範例

以下程式碼範例示範如何利用該 SkipLinkText 屬性指定螢幕閱讀器閱讀隱藏圖片的替代文字,從而提供跳過連結列表的能力。


<%@ Page Language="C#" %>

<!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>Menu SkipLinkText Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu SkipLinkText Example</h3>

      <asp:menu id="NavigationMenu"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        skiplinktext="Skip Menu" 
        runat="server">
      
        <items>
          <asp:menuitem text="Home"
            tooltip="Home">
            <asp:menuitem text="Music"
              tooltip="Music">
              <asp:menuitem text="Classical"
                tooltip="Classical"/>
              <asp:menuitem text="Rock"
                tooltip="Rock"/>
              <asp:menuitem text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem text="Movies"
              tooltip="Movies">
              <asp:menuitem text="Action"
                tooltip="Action"/>
              <asp:menuitem text="Drama"
                tooltip="Drama"/>
              <asp:menuitem text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>

<%@ Page Language="VB" %>

<!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>Menu SkipLinkText Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>Menu SkipLinkText Example</h3>

      <asp:menu id="NavigationMenu"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        skiplinktext="Skip Menu" 
        runat="server">
      
        <items>
          <asp:menuitem text="Home"
            tooltip="Home">
            <asp:menuitem text="Music"
              tooltip="Music">
              <asp:menuitem text="Classical"
                tooltip="Classical"/>
              <asp:menuitem text="Rock"
                tooltip="Rock"/>
              <asp:menuitem text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem text="Movies"
              tooltip="Movies">
              <asp:menuitem text="Action"
                tooltip="Action"/>
              <asp:menuitem text="Drama"
                tooltip="Drama"/>
              <asp:menuitem text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>

備註

使用該 SkipLinkText 屬性指定螢幕閱讀器閱讀隱藏圖片的替代文字,從而提供跳過連結列表的功能。 你指定的文字會提供輔助科技裝置隱藏跳過連結圖片的描述,讓控制更易取得。

設定後,該屬性的值可透過設計工具自動儲存到資源檔案中。 欲了解更多資訊,請參閱LocalizableAttribute全球化與在地化。

Menu控制項提供該SkipLinkText屬性,讓螢幕閱讀器能跳過整個控制項。 若設定該 SkipLinkText 屬性,會呈現一張隱形影像並搭配替代文字,讓使用者可以選擇跳到控制項的末尾。 螢幕閱讀器會大聲朗讀替代文字,影像僅佔據一個像素空間。 為了精確控制頁面渲染,將屬性設 SkipLinkText 為空字串(“”),並提供自己的機制跳過選單。 預設為 SkipLinkText 空字串。

適用於

另請參閱