HTML <form> action 属性
实例
当提交表单时,发送表单数据到名为 "demo_form.html" 的文件(处理输入):
<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="Submit">
</form>
浏览器支持




所有主流浏览器都支持 action 属性。
定义和用法
action 属性规定当提交表单时,向何处发送表单数据。
HTML 4.01 与 HTML5之间的差异
在 HTML5 中,action 属性不再是必需的。
语法
属性值
值
|
描述
|
URL
|
当表单提交时向何处发送表单数据。
可能的值:
-
绝对 URL - 指向另一个网站(比如 action="http://www.example.com/example.htm")
-
相对 URL - 指向网站内的一个文件(比如 action="example.htm")
|