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/contextmenu | |
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/contextmenu')
-rw-r--r-- | files/zh-cn/web/api/htmlelement/contextmenu/index.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlelement/contextmenu/index.html b/files/zh-cn/web/api/htmlelement/contextmenu/index.html new file mode 100644 index 0000000000..b0ee9e9d48 --- /dev/null +++ b/files/zh-cn/web/api/htmlelement/contextmenu/index.html @@ -0,0 +1,35 @@ +--- +title: HTMLElement.contextMenu +slug: Web/API/HTMLElement/contextMenu +tags: + - API +translation_of: Web/API/HTMLElement/contextMenu +--- +<div>{{APIRef("HTML DOM")}}{{deprecated_header()}}</div> + +<p><code><strong>HTMLElement.contextMenu</strong></code> 特性指的是某一元素用{{htmlattrxref("contextmenu")}} 特性所创建的右键快捷菜单。该菜单本身源于 {{HTMLElement("menu")}} 元素所构建。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var <var>elementContextMenu</var> = <var>element</var>.contextMenu; +</pre> + +<h2 id="例子">例子</h2> + +<pre class="brush: js">var contextMenu = document.getElementById("element").contextMenu; + +// 修改条目1的标签 +contextMenu.firstElementChild.label = "New label"; +</pre> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{Compat("api.HTMLElement.contextMenu")}}</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>{{htmlattrxref("contextmenu")}}</li> + <li>{{HTMLElement("menu")}}</li> + <li>{{HTMLElement("menuitem")}}</li> +</ul> |