diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/htmlelement/accesskeylabel | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/htmlelement/accesskeylabel')
-rw-r--r-- | files/zh-cn/web/api/htmlelement/accesskeylabel/index.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlelement/accesskeylabel/index.html b/files/zh-cn/web/api/htmlelement/accesskeylabel/index.html new file mode 100644 index 0000000000..b20eafe1ed --- /dev/null +++ b/files/zh-cn/web/api/htmlelement/accesskeylabel/index.html @@ -0,0 +1,84 @@ +--- +title: accessKeyLabel +slug: Web/API/HTMLElement/accessKeyLabel +translation_of: Web/API/HTMLElement/accessKeyLabel +--- +<div> +<div>{{ APIRef("HTML DOM") }}</div> +</div> + +<p><strong><code>HTMLElement.accessKeyLabel</code></strong> 只读属性返回一个 {{jsxref("String")}} 表示这个元素分配的访问密钥(如果有的话); 否则返回一个空字符串.</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><em>label</em> = <em>element</em>.accessKeyLabel +</pre> + +<h2 id="Example" name="Example">示例</h2> + +<h3 id="JavaScript">JavaScript</h3> + +<pre class="brush: js">var node = document.getElementById('btn1'); +if (node.accessKeyLabel) { + node.title += ' [' + node.accessKeyLabel + ']'; +} else { + node.title += ' [' + node.accessKey + ']'; +} + +node.onclick = function () { + var p = document.createElement('p'); + p.textContent = 'Clicked!'; + node.parentNode.appendChild(p); +}; +</pre> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><button accesskey="h" title="Caption" id="btn1">Hover me</button> +</pre> + +<h3 id="Result">Result</h3> + +<p>{{ EmbedLiveSample('Example') }}</p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', "interaction.html#dom-accesskeylabel", "HTMLElement.accessKeyLabel")}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td>No change from initial definition.</td> + </tr> + <tr> + <td>{{SpecName('HTML5.1')}}</td> + <td>{{Spec2('HTML5.1')}}</td> + <td>Removed. <a href="https://github.com/w3c/html/pull/144">pull w3c/html#144</a>, <a href="https://github.com/w3c/html/issues/99">issue w3c/html#99</a>, <a href="https://discourse.wicg.io/t/accesskeylabel-author-accessible-info-about-shortcuts/1392/3">WICG discussion</a>.</td> + </tr> + <tr> + <td>{{SpecName('HTML5 W3C', "editing.html#dom-accesskeylabel", "HTMLElement.accessKeyLabel")}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td>Snapshot of {{SpecName('HTML WHATWG')}}, initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容">浏览器兼容</h2> + +<div> + + +<p>{{Compat("api.HTMLElement.accessKeyLabel")}}</p> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{domxref("element.accessKey")}}</li> + <li>The <a href="/en-US/docs/Web/HTML/Global_attributes/accesskey">accesskey</a> global attribute.</li> +</ul> |