aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmlelement/tabindex
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/htmlelement/tabindex
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/htmlelement/tabindex')
-rw-r--r--files/zh-cn/web/api/htmlelement/tabindex/index.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlelement/tabindex/index.html b/files/zh-cn/web/api/htmlelement/tabindex/index.html
new file mode 100644
index 0000000000..516c659c2a
--- /dev/null
+++ b/files/zh-cn/web/api/htmlelement/tabindex/index.html
@@ -0,0 +1,49 @@
+---
+title: HTMLElement.tabIndex
+slug: Web/API/HTMLElement/tabIndex
+translation_of: Web/API/HTMLOrForeignElement/tabIndex
+---
+<div>
+<div>{{ APIRef("HTML DOM") }}</div>
+</div>
+
+<h3 id="Summary" name="Summary">概述</h3>
+
+<p>获取或设置当前元素的tab键激活顺序.</p>
+
+<h3 id="Syntax" name="Syntax">语法</h3>
+
+<pre class="eval">element.tabIndex = <em>index </em><em>index </em>= element.tabIndex
+</pre>
+
+<h3 id="Parameters" name="Parameters">参数</h3>
+
+<ul>
+ <li><code>index</code>是一个数字,表示顺序。取值需要在0到32767之间。</li>
+</ul>
+
+<p>Tab键的遍历顺序是这样的:</p>
+
+<ol>
+ <li>对于tabIndex值为正数的元素,如果多个元素的tabIndex值相同,则以他们出现在字符流中的次序来遍历;否则按tabIndex值由小到大的顺序来遍历。</li>
+ <li>对于不支持tabIndex属性或支持tabIndex属性并将其赋值为0的元素,按照他们出现在字符流中的次序来遍历。</li>
+ <li>处于不可用状态的元素不会被遍历到。</li>
+</ol>
+
+<p>支持tabIndex属性的元素有:a,area,button,input,object,select和textarea<font face="monospace" size="3"><span style="line-height: 19.5px;">。</span></font></p>
+
+<p>tabIndex的值不需要是连续的,也不需要以某个特定值开始。</p>
+
+<h3 id="Example" name="Example">例子</h3>
+
+<pre>var b1 = document.getElementById("button1");
+b1.tabIndex = 1;
+</pre>
+
+<h3 id="Specification" name="Specification">规范</h3>
+
+<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-40676705">W3C DOM Level 2 HTML tabIndex</a></p>
+
+<p>了解更多,请查看: <a href="/zh-cn/Key-navigable_custom_DHTML_widgets#The_solution:_changes_to_standard_behavior_of_tabindex" title="zh-cn/Key-navigable_custom_DHTML_widgets#The_solution:_changes_to_standard_behavior_of_tabindex">The solution: changes to standard behavior of tabindex</a></p>
+
+<p>{{ languages( { "ja": "ja/DOM/element.tabIndex", "fr": "fr/DOM/element.tabIndex", "pl": "pl/DOM/element.tabIndex" , "en": "en/DOM/element.tabIndex" } ) }}</p>