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/oncut | |
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/oncut')
-rw-r--r-- | files/zh-cn/web/api/htmlelement/oncut/index.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlelement/oncut/index.html b/files/zh-cn/web/api/htmlelement/oncut/index.html new file mode 100644 index 0000000000..e8d5c9c7ee --- /dev/null +++ b/files/zh-cn/web/api/htmlelement/oncut/index.html @@ -0,0 +1,46 @@ +--- +title: element.oncut +slug: Web/API/HTMLElement/oncut +translation_of: Web/API/HTMLElement/oncut +--- +<p>{{ Fx_minversion_header("3") }} {{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p><strong>oncut</strong>属性用来获取或设置当前元素的<code>cut</code>事件的事件处理函数.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval"><em>element</em>.oncut = <em>functionRef</em>; +</pre> +<p><em>functionRef</em> 是一个函数名或者函数表达式.</p> +<h3 id="Example" name="Example">例子</h3> +<pre><html> +<head> +<title>oncut示例演示</title> + +<script> + function log(txt) + { + document.getElementById("log").appendChild(document.createTextNode(txt + "\n")); + } +</script> +</head> + +<body> +<h3>按说明进行操作!</h3> +<textarea rows="3" cols="80" oncopy="log('复制成功!');" oncut="log('剪切被阻止!'); return false;"> + 尝试剪切和复制该文本域内的文本! +</textarea> +<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>cut</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.oncopy" title="zh-cn/DOM/element.oncopy">oncopy</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.oncut" ,"en": "en/DOM/element.oncut" } ) }}</p> |