aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmlfieldsetelement/index.html
blob: 97b7692640efe389d9bf9a6e5abfca67c8428da9 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
title: HTMLFieldSetElement
slug: Web/API/HTMLFieldSetElement
translation_of: Web/API/HTMLFieldSetElement
---
<p>{{ ApiRef() }}</p>
<h2 id="HTML_Field_Set_Element">HTML Field Set Element</h2>
<p>DOM <code>fieldset</code> elements expose the <a class="external" href="http://dev.w3.org/html5/spec/forms.html#htmlfieldsetelement" title="http://dev.w3.org/html5/spec/forms.html#htmlfieldsetelement">HTMLFieldSetElement</a>  ({{ HTMLVersionInline(4) }} <a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-7365882">HTMLFieldSetElement</a>) interface, which provides special properties and methods (beyond the regular <a href="../../../../zh-CN/DOM/element" rel="internal">element</a> object interface they also have available to them by inheritance) for manipulating the layout and presentation of field-set elements.</p>
<h2 id="属性">属性</h2>
<p>以下属性除了 <strong>form</strong> 都是在 {{ HTMLVersionInline(5) }} 中新添加的.</p>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">名称</th>
   <th scope="col">类型</th>
   <th scope="col">描述</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code>disabled</code></td>
   <td><code>Boolean</code></td>
   <td>读取HTML属性 {{ htmlattrxref("disabled", "fieldset") }},表明用户是否可以操作该控件.</td>
  </tr>
  <tr>
   <td><code>elements</code></td>
   <td><code>readonly <a href="/zh-CN/DOM/HTMLFormControlsCollection" title="zh-CN/DOM/HTMLFormControlsCollection">HTMLFormControlsCollection</a></code></td>
   <td>The elements belonging to this field set.</td>
  </tr>
  <tr>
   <td><code>form</code></td>
   <td><code>readonly <a href="/zh-CN/DOM/HTMLFormElement" title="zh-CN/DOM/HTMLFormElement">HTMLFormElement</a></code></td>
   <td>The containing form element, if this element is in a form. Otherwise, the element the <a href="/zh-CN/HTML/Element/fieldset#attr-name" title="zh-CN/HTML/Element/fieldset#attr-name">name content attribute</a> points to {{ HTMLVersionInline(5) }}. (<code>null</code> in {{ HTMLVersionInline(4) }}.)</td>
  </tr>
  <tr>
   <td><code>name</code></td>
   <td><code><a href="/zh-CN/DOM/DOMString" title="zh-CN/DOM/DOMString">DOMString</a></code></td>
   <td>Reflects the {{ htmlattrxref("name", "fieldset") }} HTML attribute, containing the name of the field set, used for submitting the form.</td>
  </tr>
  <tr>
   <td><code>type</code></td>
   <td><code>readonly <a href="/zh-CN/DOM/DOMString" title="zh-CN/DOM/DOMString">DOMString</a></code></td>
   <td>一定为字符串<code>fieldset</code>.</td>
  </tr>
  <tr>
   <td><code>validationMessage</code></td>
   <td><code>readonly <a href="/zh-CN/DOM/DOMString" title="zh-CN/DOM/DOMString">DOMString</a></code></td>
   <td>A localized message that describes the validation constraints that the element does not satisfy (if any). This is the empty string if the element  is not a candidate for constraint validation (<strong>willValidate</strong> is false), or it satisfies its constraints.</td>
  </tr>
  <tr>
   <td><code>validity</code></td>
   <td><code>readonly <a href="/zh-CN/DOM/ValidityState" title="zh-CN/DOM/ValidityState">ValidityState</a></code></td>
   <td>The validity states that this element is in.</td>
  </tr>
  <tr>
   <td><code>willValidate</code></td>
   <td><code>boolean</code></td>
   <td>Always false because <code>fieldset</code> objects are never candidates for constraint validation.</td>
  </tr>
 </tbody>
</table>
<h2 id="方法">方法</h2>
<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">名称 &amp; 参数</th>
   <th scope="col">返回值</th>
   <th scope="col">描述</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code>checkValidity</code>()</td>
   <td><code>Boolean</code></td>
   <td>如果元素的值没有有效性问题,则返<code>回true</code>,否则返回<code>false</code>并触发<code>invalid</code>事件.</td>
  </tr>
  <tr>
   <td><code>setCustomValidity(in </code><a href="/zh-CN/DOM/DOMString" title="zh-CN/DOM/DOMString">DOMString</a><code> error) </code></td>
   <td><code>void</code></td>
   <td>设置一个自定义错误,则该元素将无法通过有效性验证.参数指定的字符串就是在向用户报告错误时显示的消息.如果为空字符串,则清除这个自定义错误.</td>
  </tr>
 </tbody>
</table>
<p> </p>