--- title: element.oncut slug: Web/API/HTMLElement/oncut tags: - DOM - Gecko - Gecko DOM Reference translation_of: Web/API/HTMLElement/oncut ---
{{ Fx_minversion_header(3) }} {{ ApiRef() }} {{ 英語版章題("Summary") }}
oncut プロパティは、現在の要素での onCut イベントハンドラのコードを返します。
{{ 英語版章題("Syntax") }}
element.oncut =functionRef;
ここでの functionRef は、関数です。それは、たいてい、他の場所で宣言された関数の名前、あるいは、 function 式 です。Core JavaScript 1.5 Reference:Functions を参照してください。
{{ 英語版章題("Example") }}
<html>
<head>
<title>oncut event example</title>
<script>
function log(txt)
{
document.getElementById("log").appendChild(document.createTextNode(txt + "\n"));
}
</script>
</head>
<body>
<h3>Play with this editor!</h3>
<textarea rows="3" cols="80" oncopy="log('Copied!');" oncut="log('Cut blocked!'); return false;">
Try copying and cutting the text in this area!
</textarea>
<h3>Log</h3>
<textarea rows="15" cols="80" id="log" readonly="true"></textarea>
</body>
</html>
この例では、テキストエリアからテキストをコピーすることはできますが、切り取ることはできません。また、コピーと切り取りの試みのログを表示します。
{{ 英語版章題("Notes") }}
このイベントは、ユーザがテキストを切り取ろうとしたときに発生します。
{{ 英語版章題("Specification") }}
仕様の一部ではありません。
{{ 英語版章題("See also") }}
{{ languages( { "en": "en/DOM/element.oncut" } ) }}