accesskey的运用·原创作品(翻译)

原创作品(翻译)

快捷键的属性
accesskey=“英文字符”
    这属性是元素的指定快捷键,快捷键是字符集的单字符。
 注意:你必须考虑到有的用户有这方面的特别的快捷键,要用快捷键。

按下快捷键,指定元素获得焦点。这个事件的发生是当元素获得焦点的时候,获得焦点灯依赖于元素,
例如:当用户点击联结标识如A元素(< a>),用户代理(系统)就指向联结的文件的,当用户点击单选按钮(RADIO BUTTON)时,系统就改变了单选按钮的值;当用户点击了文本框(TEXT FIED),它就获得焦点
可以添加值,还有INPUT等等元素。
还有一些支持快捷键属性的元素:A, AREA, BUTTON, INPUT, LABEL, and LEGEND, and TEXTAREA.
这个例子的快捷键“U”应用于LABEL与INPUT控件的
指定快捷键来获得焦点,通过LABEL来得到焦点,这样用户就可在INPUT里写值啦,
<FORM action="..." method="post">
<P>
<LABEL for="fuser" accesskey="U">
User Name
</LABEL>
<INPUT type="text" name="user" id="fuser">
</P>
</FORM>
下面这个例子,我们指定一个快捷键在A元素(<a>)里,通过这个快捷键可指向另一个文件,
在这例子的代码是表格的一部分。
<P><A accesskey="C"
      rel="contents"
      href=http://blog.csdn.net/kennymoni>
    Table of Contents</A>
快捷键依赖与系统的。例如,在微软的操作系统里,有一个快捷键是“ALT”,在另一个系统里,有一个“CMD”快捷键,
快捷键的范畴依靠用户的运用,我们提醒用户包括快捷键在LABEL或者快捷键被运用时,用户代理(系统)
必须指定它有点特别,来突出快捷键的作用,使它区别与其他的字符(如:加下划线)

17.11.2 Access keys

Attribute definitions

accesskey = character [CN]
This attribute assigns an access key to an element. An access key is a single character from the document character set. Note. Authors should consider the input method of the expected reader when specifying an accesskey.

Pressing an access key assigned to an element gives focus to the element. The action that occurs when an element receives focus depends on the element. For example, when a user activates a link defined by the A element, the user agent generally follows the link. When a user activates a radio button, the user agent changes the value of the radio button. When the user activates a text field, it allows input, etc.

The following elements support the accesskey attribute: A, AREA, BUTTON, INPUT, LABEL, and LEGEND, and TEXTAREA.

This example assigns the access key "U" to a label associated with an INPUT control. Typing the access key gives focus to the label which in turn gives it to the associated control. The user may then enter text into the INPUT area.

<FORM action="..." method="post">
<P>
<LABEL for="fuser" accesskey="U">
User Name
</LABEL>
<INPUT type="text" name="user" id="fuser">
</P>
</FORM>

In this example, we assign an access key to a link defined by the A element. Typing this access key takes the user to another document, in this case, a table of contents.

<P><A accesskey="C" 
      rel="contents"
      href="http://someplace.com/specification/contents.html">
    Table of Contents</A>

The invocation of access keys depends on the underlying system. For instance, on machines running MS Windows, one generally has to press the "alt" key in addition to the access key. On Apple systems, one generally has to press the "cmd" key in addition to the access key.

The rendering of access keys depends on the user agent. We recommend that authors include the access key in label text or wherever the access key is to apply. User agents should render the value of an access key in such a way as to emphasize its role and to distinguish it from other characters (e.g., by underlining it).

参考:http://www.w3.org/TR/html4/interact/forms.html#adef-accesskey

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值