From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/globaleventhandlers/onselect/index.html | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 files/ja/web/api/globaleventhandlers/onselect/index.html (limited to 'files/ja/web/api/globaleventhandlers/onselect') diff --git a/files/ja/web/api/globaleventhandlers/onselect/index.html b/files/ja/web/api/globaleventhandlers/onselect/index.html new file mode 100644 index 0000000000..31ac15ff9c --- /dev/null +++ b/files/ja/web/api/globaleventhandlers/onselect/index.html @@ -0,0 +1,81 @@ +--- +title: window.onselect +slug: Web/API/GlobalEventHandlers/onselect +tags: + - DOM + - Gecko + - Window +translation_of: Web/API/GlobalEventHandlers/onselect +--- +
{{ ApiRef("HTML DOM") }}
+ +

{{domxref("window")}} の select イベントに対応するイベントハンドラです。

+ +

構文

+ +
window.onselect = funcRef;
+
+ + + +

+ +
<!DOCTYPE html>
+<html lang="ja">
+<head>
+<meta charset="UTF-8" />
+<title>onselect のテスト</title>
+
+<style>
+.text1 { border: 2px solid red; }
+</style>
+
+<script>
+window.onselect = selectText;
+
+function selectText() {
+  alert("select イベントが発生しました。");
+}
+</script>
+</head>
+
+<body>
+<textarea class="text1" cols="30" rows="3">
+マウスでこのテキストを選択状態にすると
+onselect イベントが発生し、
+アラートを表示する関数が実行されます。
+</textarea>
+</body>
+</html>
+
+ +

注記

+ +

select イベントは、テキストインプット (<input type="text">) もしくは {{htmlelement("textarea")}} 要素のテキストが選択された直後に 発生します。

+ +

仕様

+ + + + + + + + + + + + + + +
仕様書策定状況コメント
{{SpecName('HTML WHATWG','webappapis.html#handler-onselect','onselect')}}{{Spec2('HTML WHATWG')}} 
+ +

ブラウザー実装状況

+ +
+ + +

{{Compat("api.GlobalEventHandlers.onselect")}}

+
-- cgit v1.2.3-54-g00ecf