HTML <fieldset> name 属性

定义和用法

name 属性规定字段集的名称。

name 属性用于在 JavaScript 中引用元素,或在提交表单后引用表单数据。

实例

带有 name 属性的 <fieldset>:

<form action="/action_page.php" method="get">
  <fieldset name="personalia">
    <label for="fname">Tên:</label>
    <input type="text" id="fname" name="fname">
  </fieldset>
  <br>
  <button type="button"
  onclick="form.personalia.style.backgroundColor='yellow'">
  Thay đổi màu nền của trường dữ liệu</button>
  <input type="submit">
</form>

Thử ngay

Cú pháp

<fieldset name="text">

Giá trị thuộc tính

Giá trị Mô tả
name Định nghĩa tên của trường dữ liệu.

Hỗ trợ trình duyệt

Số trong bảng chỉ ra phiên bản trình duyệt đầu tiên hỗ trợ thuộc tính này hoàn toàn.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Hỗ trợ 11.0 Hỗ trợ Hỗ trợ Hỗ trợ