Properties


METHOD Attribute | method Property

Sets or retrieves how to send the form data to the server.

Syntax

HTML<ELEMENT METHOD = sMethod... >
Scripting[ sMethod = ] object.method

Possible Values

sMethodString that specifies or receives one of the following values.
GET
Append the arguments to the action URL and open it as if it were an anchor.
POST
Send the data through an HTTP post transaction.

The property is read/write. The property has no default value.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

Remarks

When the user enters information in a form and clicks the submit button, there are two ways the information can be sent from the browser to the server: as part of the URL, or within the body of the HTTP request.

The GET method appends name/value pairs to the URL. The amount of data that can be sent is limited by the maximum length of a URL, which is 2048 bytes. The URL could be truncated if the form uses a large number of parameters, or if the parameters contain large amounts of data. Parameters passed on the URL are visible in the address field of the browser.

This POST method packages the name/value pairs inside the body of the HTTP request. When using the POST method, there is no theoretical limit to the amount of data that can be sent to the server. Because the parameters are not appended to the URL, this method is slightly more secure.

Standards Information

This property is defined in HTML 3.2 World Wide Web link and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 World Wide Web link.

Applies To

FORM, HTMLFormElement Constructor

See Also

action
Tags :


Page view tracker