diff options
Diffstat (limited to 'files/ja/web/api/htmlelement/onpaste/index.html')
| -rw-r--r-- | files/ja/web/api/htmlelement/onpaste/index.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/files/ja/web/api/htmlelement/onpaste/index.html b/files/ja/web/api/htmlelement/onpaste/index.html new file mode 100644 index 0000000000..71c5e05538 --- /dev/null +++ b/files/ja/web/api/htmlelement/onpaste/index.html @@ -0,0 +1,86 @@ +--- +title: HTMLElement.onpaste +slug: Web/API/HTMLElement/onpaste +tags: + - API + - API + - HTMLElement + - HTMLElement + - イベントハンドラー + - イベントハンドラー + - プロパティ + - プロパティ + - リファレンス + - 標準外 +translation_of: Web/API/HTMLElement/onpaste +--- +<div>{{ APIRef("HTML DOM") }} {{Non-standard_header}}</div> + +<p><strong>onpaste</strong> プロパティは、現在の要素の onPaste イベントハンドラーを返します。 {{event("paste")}} の W3C 草稿を参照してください。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox"><em>element</em>.onpaste = <em>functionRef</em>;</pre> + +<p>ここでの <em>functionRef</em> は関数です。それはたいてい、他の場所で宣言された関数の名前、あるいは <em>function 式</em>です。詳しくは <a href="/ja/docs/Web/JavaScript/Reference/Global_Objects/Function">JavaScript リファレンス:Functions</a> を参照してください。</p> + +<h2 id="Example" name="Example">例</h2> + +<pre class="brush:html"><!DOCTYPE html> +<html> +<head> +<title>onpaste event example</title> +</head> + +<body> +<h1>Play with this editor!</h1> +<textarea id="editor" rows="3" cols="80"> +Try pasting text into this area! +</textarea> + +<script> +function log(txt) { + document.getElementById("log").appendChild(document.createTextNode(txt + "\n")); +} + +function pasteIntercept(evt) { + log("Pasting!"); +} + +document.getElementById("editor").addEventListener("paste", pasteIntercept, false); +</script> + +<h2>Log</h2> +<textarea rows="15" cols="80" id="log" readonly="true"></textarea> +</body> +</html></pre> + +<p>この例は、テキストエリアへの貼り付けのログを表示します。</p> + +<h2 id="Notes" name="Notes">メモ</h2> + +<p>このイベントは、ユーザがテキストを貼り付けしようとしたときに発生します。</p> + +<p>Firefox 13 から、この機能は設定 <code>dom.event.clipboardevents.enabled</code> で制御されます。既定値は <code>true</code> ですが無効化できます。</p> + +<h2 id="Specification" name="Specification">仕様書</h2> + +<p>仕様の一部ではありません。</p> + +<h2 id="Notes_2" name="Notes_2">メモ</h2> + +<p>現在、 DOM だけでペーストされたテキストを得る方法はありません。その情報を得るためには {{ Interface("nsIClipboard") }} を用いる必要があります。</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> + +<p class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力したいのであれば、 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</p> + +<p>{{Compat("api.HTMLElement.onpaste")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{event("paste")}}</li> + <li>{{domxref("HTMLElement.oncopy")}}</li> + <li>{{domxref("HTMLElement.oncut")}}</li> +</ul> |
