--- title:
HTML <form> 元素表示提交訊息的區塊,此區塊含有許多可互動的控制項。
<form>
It is possible to use the {{cssxref(':valid')}} and {{cssxref(':invalid')}} CSS pseudo-classes to style a <form> element based on whether or not the {{domxref("HTMLFormElement.elements", "elements")}} inside the form are valid.
form
search
This element includes the global attributes.
<input type=file>
<input type="submit">
<input type="image">
autocapitalize
none
sentences
words
characters
autocomplete
off
on
method
post
enctype
application/x-www-form-urlencoded
multipart/form-data
type=file
text/plain
This value can be overridden by {{htmlattrxref("formenctype", "button")}} attributes on {{HTMLElement("button")}}, <input type="submit">, or <input type="image"> elements.
get
action
?
dialog
This value is overridden by {{htmlattrxref("formmethod", "button")}} attributes on {{HTMLElement("button")}}, <input type="submit">, or <input type="image"> elements.
id
_self
_blank
_parent
_top
This value can be overridden by a {{htmlattrxref("formtarget", "button")}} attribute on a {{HTMLElement("button")}}, <input type="submit">, or <input type="image"> element.
<!-- Form which will send a GET request to the current URL --> <form> <label>Name: <input name="submitted-name" autocomplete="name"> </label> <button>Save</button> </form> <!-- Form which will send a POST request to the current URL --> <form method="post"> <label>Name: <input name="submitted-name" autocomplete="name"> </label> <button>Save</button> </form> <!-- Form with fieldset, legend, and label --> <form method="post"> <fieldset> <legend>Title</legend> <label><input type="radio" name="radio"> Select me</label> </fieldset> </form>
{{ EmbedLiveSample('Examples', '100%', 110) }}
{{Compat("html.elements.form")}}