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/oncopy | |
| 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/oncopy')
| -rw-r--r-- | files/zh-cn/web/api/htmlelement/oncopy/index.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlelement/oncopy/index.html b/files/zh-cn/web/api/htmlelement/oncopy/index.html new file mode 100644 index 0000000000..12ff84d885 --- /dev/null +++ b/files/zh-cn/web/api/htmlelement/oncopy/index.html @@ -0,0 +1,44 @@ +--- +title: element.oncopy +slug: Web/API/HTMLElement/oncopy +translation_of: Web/API/HTMLElement/oncopy +--- +<p>{{ Fx_minversion_header("3") }} {{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p><strong>oncopy</strong>属性用来获取或设置当前元素的<code>copy</code>事件的事件处理函数.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval"><em>element</em>.oncopy = <em>functionRef</em>; +</pre> +<p><em>functionRef</em> 是一个函数名或者函数表达式.</p> +<h3 id="Example" name="Example">例子</h3> +<pre><html> +<head> +<title>oncopy示例演示</title> + +<script> + function log(txt) + { + document.getElementById("log").appendChild(document.createTextNode(txt + "\n")); + } +</script> +</head> + +<body> +<div oncopy="log('复制被阻止!'); return false;">试着复制这句话!</div> + +<h3>Log</h3> +<textarea rows="15" cols="80" id="log" readonly="true"></textarea> +</body> +</html> +</pre> +<p>上例演示了如何禁止复制浏览器中的一段话.</p> +<h3 id="Notes" name="Notes">备注</h3> +<p>当用户尝试复制选中元素或文本时会触发<code>copy</code>事件.</p> +<h3 id="Specification" name="Specification">规范</h3> +<p>不属于任何公开的规范.</p> +<h3 id="See_also" name="See_also">相关链接</h3> +<ul> + <li><code><a href="/zh-cn/DOM/element.oncut" title="zh-cn/DOM/element.oncut">oncut</a></code></li> + <li><code><a href="/zh-cn/DOM/element.onpaste" title="zh-cn/DOM/element.onpaste">onpaste</a></code></li> +</ul> +<p>{{ languages( { "ja": "ja/DOM/element.oncopy", "en": "en/DOM/element.oncopy" } ) }}</p> |
