HTML <form> actionAttribute

HTML form 标签参考手册HTML <form> Tag

Examples

When submitting the form, send the form data to a file named "demo_form.html" (to process the input):

<form action="demo_form.html" method="get">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
<input type="submit" value="提交">
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the action attribute.


Definition and Usage

The action attribute specifies where to send the form data when a form is submitted.


Differences Between HTML 4.01 and HTML5

In HTML5, the action attribute is no longer required.


Syntax

<form action="URL">

Attribute Values

Value Description
URL Where to send the form data when the form is submitted.

Possible values:

  • Absolute URL - points to another website (e.g. action="http://www.example.com/example.htm")
  • Relative URL - points to a file within the website (e.g. action="example.htm")


HTML form 标签参考手册HTML <form> Tag Other extensions