Home  >  Article  >  Web Front-end  >  Web Design TabIndex Element_HTML/Xhtml_Web Page Production

Web Design TabIndex Element_HTML/Xhtml_Web Page Production

WBOY
WBOYOriginal
2016-05-16 16:42:141394browse

TabIndex is to press the Tab key to sequentially obtain the focus of the defined TabIndex elements set between each element.

Anyone who has made or filled out a form will find that using the Tab key can get the focus of each input one by one. This stuff can actually be modified, such as not wanting to be obtained, or changing the order in which it is obtained.

When filling out a form (registration, login or other), many users directly press the Tab key to jump to the next text box without using the mouse. Wait until everything is filled out, and then Yes Submit, which is a very nice and convenient feature. My personal habit is that after filling in all the things, I usually use the mouse to click the submit button, and I don’t want Tab to cause the focus to jump to the button, but I rarely find that when using Tab, the focus will not jump to the button. On the button, I don’t know if it’s just my personal habits that are too BT-_-!!!

If you don’t want something to be focused, you can tabindex=-x, so that the value of tabindex is negative. In this case Tab will skip directly.

The following is a simple form as an example:



Tip: You can modify part of the code before running

Copy Code
The code is as follows:




The Second pressing Tab to set focus to textbox


Press Tab, Not focusing to textbox < ;/p>



Using the Tab key, the order of getting focus is sorted by the value of tabindex. In the above example, t1, t2, and t3 gain focus in sequence. When it reaches t4, since the value of TabIndex is -1, t4 will not gain focus, but jumps directly to the next element that gains focus.
 The TabIndex value of t1, t2, t3, t4 can be changed arbitrarily according to actual needs, and the Tab focus is obtained according to the value from small to large. TabIndex is used to do this. . .
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn