如何更改网页上的输入字段切换顺序(使用Tab键切换输入字段)? [英] How to change input field switch sequence (swithcing input field using Tab key) on a web page?
问题描述
在网页上,如果有输入字段,请按Tab键切换它们,但是按特定顺序,是否可以更改此顺序并将其设置为其他顺序?
On a web page, if there are input fields, pressing Tab key switches them, but in a particular order, is there a way to change this order and set it to some different order?
如果可以用html完成,则更好,但如果其他脚本语言(javascript等)也可以,则也是可以接受的.
If this can be done in html, it is preferable, but if some other scripting language (javascript etc) can do it, it is also acceptable.
推荐答案
The attribute tabindex
takes care of that http://www.w3.org/TR/WCAG-TECHS/H4.html
to exclude a element completely from the tabindex give it a index of -1
the lowest safe index to start with is 1
.
0
是默认值,因此在显式设置tabindex
0
is the default value so should be avoided when explicitly setting the tabindex
<input tabindex=1 type="text" name="my_input1">
<input tabindex=3 type="text" name="my_input2">
<input tabindex=2 type="text" name="my_input3">
在此示例中,该标签将从my_input1
到my_input3
到my_input2
字段
The tab would go from the my_input1
to my_input3
to my_input2
field in this example
tabindex可以用于a
,area
,button
,input
,object
,select
和textarea
tabindex may be used on a
, area
, button
, input
, object
, select
and textarea
这篇关于如何更改网页上的输入字段切换顺序(使用Tab键切换输入字段)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!