ASP.NET 复选框/单选列表箭头键
我有一个用于数据输入的 ASP.NET Web 应用程序,并且在某些部分有大量单选按钮列表和一长串复选框。
客户希望能够使用键盘导航和操作这些控件,例如制表符/空格/输入/右左上下箭头键。有我可以使用的 ASP.NET 控件吗?
I have an ASP.NET web application for data entry, and we have big lists of radiobuttons, and long lists of checkboxes, in some sections.
The client wants to be able to be able to navigate and manipulate these controls with their keyboard, like the tab/space/enter/right-left-up-down-arrow-keys. Are there any ASP.NET controls that I can use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用控件的 TabIndex 属性和 AccessKey 属性。 TabIndex 将允许使用
Tab
键按顺序导航控件。 AccessKey 属性可用于设置特定的键盘字母来访问输入字段。使用 Jquery,您可以使用
.keypress()
事件来检测如果按下向上/向下键(请参阅此了解一些提示)。然后,当与 TabIndex 属性结合使用时,您可以将焦点设置到下一个/上一个输入字段。You could use the TabIndex property and AccessKey properties of controls. The TabIndex will allow for in order navigation of controls using the
Tab
key. The AccessKey property can be used to set a specific keyboard letter to access the input field.Using Jquery, you could use the
.keypress()
event to detect if the up/down key was press (See this for some hints). Then when used in conjunction with the TabIndex property, you could set focus to the next/previous input field.这是可以实现的,但需要一些编码。您可能需要向正文添加 keyup 事件并处理按键。我对 Jquery UI 选项卡(左右键)做了同样的事情。您可以使用这个概念来完成您的工作。
http:// /ctrlshiftb.wordpress.com/2010/02/03/how-to-add-keyboard-navigation-for-jquery-ui-tabs/
希望这有帮助。
谢谢,
拉惹
This could be accomplished but it requires a bit of coding. You may have to add a keyup event to the body and handle the keys. I did the same for Jquery UI Tabs (right and left keys). You can use the concept to accomplish your stuff.
http://ctrlshiftb.wordpress.com/2010/02/03/how-to-add-keyboard-navigation-for-jquery-ui-tabs/
Hope this helps.
Thanks,
Raja
我可能误解了这个问题,但如果您设置焦点,例如
键盘快捷键(例如箭头键/空格等)可以作为标准行为吗?
如果您想要更复杂的功能,您可以向控件添加 javascript 属性。此链接很有用链接文本
I may have misunderstood the question but if you set focus e.g.
keyboard shortcuts e.g. arrow-keys/space etc are available as standard behavior?
If you want more complex functionality you could add javascript attributes to you controls. This link is useful link text