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

属性值

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 属性设置为空字符串。

适用于

另请参阅