Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Form method property

Form method property

Form Object Reference Form Object


Definition and Usage

The method property can set or return the value of the method attribute of the form.

The method property specifies how the form data is sent (the form data submission address is specified in the action attribute).

Syntax

formObject.method=

value

The method property can be one of the following values:

Value Description
get Adds form data to the URL: URL?name=value&name=value (default)
post Uses the HTTP POST method to submit the form data

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the method property

Note: Internet Explorer returns "get" if the method attribute is not defined (default), while other browsers return no value.


Example

Example

Return the method used to send the form data:

First name:

Last name:

The example above produces the following output:

get

Try it »


Form Object Reference Form Object