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/ja/web/api/htmlselectelement/autofocus | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/ja/web/api/htmlselectelement/autofocus')
| -rw-r--r-- | files/ja/web/api/htmlselectelement/autofocus/index.html | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/files/ja/web/api/htmlselectelement/autofocus/index.html b/files/ja/web/api/htmlselectelement/autofocus/index.html new file mode 100644 index 0000000000..b74bec952a --- /dev/null +++ b/files/ja/web/api/htmlselectelement/autofocus/index.html @@ -0,0 +1,70 @@ +--- +title: HTMLSelectElement.autofocus +slug: Web/API/HTMLSelectElement/autofocus +tags: + - API + - HTML forms + - HTMLSelectElement + - Property + - Reference +translation_of: Web/API/HTMLSelectElement/autofocus +--- +<p>{{ APIRef("HTML DOM") }}</p> + +<p><code><strong>HTMLSelectElement.autofocus</strong></code> プロパティは {{htmlattrxref("autofocus", "select")}} HTML属性を反映した {{jsxref("Boolean")}} です。これはユーザーが上書きしない限り、ページが読み込まれた際に関連付けられた {{HTMLElement("select")}} 要素がページ読み込み時に入力フォーカスを得るかどうかを示します。</p> + +<p>ドキュメント内のフォームに関連した、一つの要素だけがこの属性を指定できます。もし複数あった場合、属性がセットされた最初の要素 (通常はページの最初の要素) が初期のフォーカスを得ます。</p> + +<div class="note"> +<p>このプロパティを設定しても、関連付けられてた {{HTMLElement("select")}} 要素へフォーカスはセットされません: 単純にドキュメントへ <em>要素が挿入された</em> ときにブラウザへフォーカスするように指示するだけです。挿入後の設定、ドキュメントが読み込まれた後のほとんどの時間では、目に見える効果はありません。</p> +</div> + +<h2 id="Syntax" name="Syntax">文法<a class="button section-edit only-icon" href="/ja/docs/Web/API/HTMLSelectElement/type$edit#Syntax"><span>Edit</span></a></h2> + +<pre class="syntaxbox" id="comment_text_10">aBool = aSelectElement.autofocus; // Get the value of autofocus +aSelectElement.autofocus = aBool; // Set the value of autofocus +</pre> + +<h2 id="Example" name="Example">例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush:html"><select id="mySelect" autofocus> + <option>Option 1</option> + <option>Option 2</option> +</select> +</pre> + +<h3 id="JavaScript">JavaScript</h3> + +<pre class="brush:js">// Check if the autofocus attribute on the <select> +var hasAutofocus = document.getElementById('mySelect').autofocus; +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">ステータス</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('HTML WHATWG', '#dom-fe-autofocus', 'autofocus')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('HTML5 W3C', '#dom-htmlinputelement-autofocus', 'autofocus')}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("api.HTMLSelectElement.autofocus")}}</p> |
