Javascript 如何获取当前活动控件的 TabIndex 属性?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5093985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 15:38:19  来源:igfitidea点击:

How to get TabIndex property of currently active control?

javascriptasp.netcontrolstabindex

提问by mehul9595

How do I find the TabIndexproperty of the control who has the active focus at runtime. I am using UlitmateEditor(Text Editor) i.e User Control , so i want focus inside the body of that Editor.

如何找到TabIndex在运行时具有活动焦点的控件的属性。我正在使用 UlitmateEditor(Text Editor) 即用户控件,所以我希望焦点在该编辑器的主体内。

回答by Kelsey

You should be able to just do:

你应该能够做到:

alert(document.activeElement.tabIndex);

The should get you the active control and its tab index.

应该为您提供活动控件及其选项卡索引。

回答by kirilloid

AFAIK asp.net is a technology for serving HTML pages =)
If you want to know tabindex of current element in HTML, then you should use document.activeElement.tabIndex. this seems to be javascript question, though.

AFAIK asp.net 是一种为 HTML 页面提供服务的技术 =)
如果您想知道 HTML 中当前元素的 tabindex,那么您应该使用 document.activeElement.tabIndex. 不过,这似乎是 javascript 问题。