views:

27

answers:

3

i have a textbox follow by a selectbox, when i press "tab" on textbox, it doesnt go to selectbox. how to make it go to selectbox? is the solution required to use javascript? is there any workaround without using javascript?

editted:

<html>
<input type="text" tabindex="1" />
<select tabindex="2" >
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>
</html>

i tried the selectbox on firefox, but fail. can it work on firefox? is it because of macos problem? textbox seem ok .

+3  A: 

Use the html tabindex attribute: http://reference.sitepoint.com/html/a/tabindex

The tabindex is used to define a sequence that users follow when they use the Tab key to navigate through a page. By default, the natural tabbing order will match the source order in the markup. In certain circumstances it may be necessary to override the default tabbing order...

A tabindex can start at 0 and increment in any value. As such, the sequence 1, 2, 3, 4, 5 would be fine, as would 10, 20, 30, 40, 50....

mck89
+1  A: 

Have you tried tabindex?

<input type="text" tabindex=1 />
<select tabindex=2 >
  <option></option>
</select>
d2burke
With quotes around the numbers for XHTML ;)
Litso
lol, yes, yes indeed Litso...what a stickler! haha
d2burke
+1  A: 

Setting a tabindex on both elements with a value of 1 higher for the selectbox than the one on the textbox (1 and 2, 2 and 3, 99 and 100)

Litso