如何在使用Tab键时更改文本字段选择顺序 [英] How to change text field selection order when using tab key

查看:122
本文介绍了如何在使用Tab键时更改文本字段选择顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



不管怎么说,我在这里在我的页面上有这个联系表单:

a href =http://leongaban.com/ =nofollow> http://leongaban.com/



当您点击名称并填写名称时,您可以标签到下一个字段的电子邮件。在输入电子邮件后,用户很自然地再次进入消息框。



然而,由于某种原因,我的选项卡选项一直跳到顶部页面,似乎选择我的投资组合主导航链接。还有几个选项卡,我回到了textarea消息。



这当然不是很理想,有没有一种方法可以强制选项卡选择按正确的顺序?即: Name> Email> Message> Captcha> Submit



我目前的表单(HTML)

 < div class =the-form> 
< form id =myFormaction =#method =post>

< div>
< label for =name>您的名称< / label>
< input type =textname =nameid =namevalue =tabindex =1>
< / div>

< div>
< label for =email>您的电子邮件< / label>
< input type =textname =emailid =emailvalue =tabindex =1>
< / div>

< div>
< label for =textarea>消息:< / label>
< / div>

< div>
< textarea cols =40rows =8name =messageid =message>< / textarea>
< / div>

< p>< em>什么是2 + 3?< / em>< / p>
< input type =textname =captchaid =captcha/>

< div>
< input class =submit-buttontype =submitvalue =Submit>
< / div>

< / form>
< / div>

< / footer>


解决方案

你必须给你的 tabindex ,按照你希望他们去的顺序。

 < input type =textname =nameid =namevalue =tabindex =1 > 
< input type =textname =emailid =emailvalue =tabindex =2>