aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/htmlformelement/name/index.html
blob: 0933aa22b7773f8c32593919ad690773bbdc06b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
title: HTMLFormElement.name
slug: Web/API/HTMLFormElement/name
tags:
  - DOM
  - Gecko
  - Gecko DOM Reference
translation_of: Web/API/HTMLFormElement/name
---
<h2 id="Summary" name="Summary">概要</h2>
<p>form の <code>name</code> 属性は、その <code>form</code> 要素の名前を文字列として返します。</p>
<h2 id="Syntax" name="Syntax">構文</h2>
<pre class="syntaxbox"><em>string</em> = form.name; //取得
form.name = <em>string</em>; //設定</pre>
<h2 id="Example" name="Example"></h2>
<pre class="brush:js">var form1_Name = document.getElementById("form1").name;

if (form1_Name != document.form.name) {
   // browser doesn't support this form of reference
}</pre>
<h2 id="Notes" name="Notes">注意</h2>
<p>この属性は読み書きともに可能であり、フォーム名の読取り及び設定に使用できます。</p>
<p>もしフォーム内に "name" と名付けられた要素を含めてしまった場合、その要素が優先され、<code>name</code> 属性でのフォームオーナーへのアクセスが出来なくなってしまいます。</p>
<p>Internet Explorer (IE) では、<code>createElement()</code> メソッドによって作成された要素に対する <code>name</code> 属性を用いての名前の設定 / 書換は許可されていません。</p>
<h2 id="Specification" name="Specification">仕様書</h2>
<ul>
  <li><a href="http://www.w3.org/TR/html5/forms.html#dom-form-name">HTML5, Section 4.10.3, The form Element</a></li>
  <li><a href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-22051454">DOM Level 2 HTML: name</a></li>
</ul>