html 中 TabIndex 属性 的含义

来源:互联网 发布:ubuntu 虚拟终端 编辑:程序博客网 时间:2024/06/04 08:27
参考地址:1、http://blog.163.com/huan12_8/blog/static/1305190902011274739628/2、http://www.imwangfu.com/tabindex-1%E6%9C%89%E4%BD%95%E4%BD%9C%E7%94%A8%EF%BC%9F/案例地址:1、 https://github.com/yuhaizr/htmlexample/commit/491869609636474b928322a07abe1265af36a7d2

1、tabindex 属性可以设置键盘中的TAB键在控件中的移动顺序,及焦点的顺序


2、 tabindex 属性值范围在1到32767之间


3、 默认的 tabindex 的值为 0 ,将排在所有指定tableIndex的控件之后


4、 如果把 tabindex 的属性设置为负值,那么这个控件 将会被排除在 TAB键的序列之外


5、 tabindex 设置任意值 esc 都会起作用


6、tabindex 属性显性的定义了一个页面中foucusable(可定焦)元素的导航顺序

<a href="http://webaim.org/" tabindex="1">tabindex1</a><form action="submit.htm" method="post"><input type="submit" id="submitform1" tabindex="-1" value="tabindex-1"><input type="submit" id="submitform0" tabindex="0" value="tabindex0"><label for="name">Name</label><input type="text" id="name" tabindex="2"><input type="submit" id="submitform" tabindex="3" value="tabindex3"></form>

按Tab键的时候

a、执行tabindex=”1”

b、执行tabindex=”2” …

c、执行tabindex=”0”

d、tabindex=”-1” 不执行


7、tabIndex=’-1’ 的使用
模态对话框窗口打开时焦点应该在对话框屛,用户将开始阅读上面的内容并且键盘将开始导航焦点放在的对话框。因为对话框(可以是div)是默认设置成不可定焦的,分陪tabindex=’-1’


0 0