代码示例:(标识:html5_input_form)
<!DOCTYPE html>
<html>
<body>

<h1>input form 属性</h1>

<p>form 属性指定输入元素所属的表单。</p>

<form action="/index/demo/form_current.html" id="form1">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="submit" value="提交">
</form>

<p>下面的 "Last name" 字段在 form 元素之外,但仍是表单的一部分。</p>

<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname" form="form1">

</body>
</html>
运行结果: