表单元素
form
attribute definitions
action = uri [ct]
this attribute specifies a form processing agent. user agent behavior for a value other than an http uri is undefined.
method = get|post [ci]
this attribute specifies which http method will be used to submit the form data set. possible (case-insensitive) values are "get" (the default) and "post". see the section on form submission for usage information.
enctype = content-type [ci]
this attribute specifies the content type used to submit the form to the server (when the value of method is "post"). the default value for this attribute is "application/x-www-form-urlencoded". the value "multipart/form-data" should be used in combination with the input element, type="file".
accept-charset = charset list [ci]
this attribute specifies the list of character encodings for input data that is accepted by the server processing this form. the value is a space- and/or comma-delimited list of charset values. the client must interpret this list as an exclusive-or list, i.e., the server is able to accept any single character encoding per entity received.
the default value for this attribute is the reserved string "unknown". user agents may interpret this value as the character encoding that was used to transmit the document containing this form element.
accept = content-type-list [ci]
this attribute specifies a comma-separated list of content types that a server processing this form will handle correctly. user agents may use this information to filter out non-conforming files when prompting a user to select files to be sent to the server (cf. the input element when type="file").
name = cdata [ci]
this attribute names the element so that it may be referred to from style sheets or scripts. note. this attribute has been included for backwards compatibility. applications should use the id attribute to identify elements.
the form element acts as a container for controls. it specifies:
the layout of the form (given by the contents of the element).
the program that will handle the completed and submitted form (the action attribute). the receiving program must be able to parse name/value pairs in order to make use of them.
the method by which user data will be sent to the server (the method attribute).
a character encoding that must be accepted by the server in order to handle this form (the accept-charset attribute). user agents may advise the user of the value of the accept-charset attribute and/or restrict the user's ability to enter unrecognized characters.
a form can contain text and markup (paragraphs, lists, etc.) in addition to form controls.
the following example shows a form that is to be processed by the "adduser" program when submitted. the form will be sent to the program using the http "post" method.
<form action="http://somesite.com/prog/adduser" method="post">
...f