HTML 標籤的 action 屬性和method屬性

aciton定義和用法

必需的 action 屬性規定當提交表單時,向何處發送表單數據。post

實例

下面的表單擁有兩個輸入字段以及一個提交按鈕,當提交表單時,表單數據會提交到名爲 "form_action.asp" 的頁面:code

<form  method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>

action="form_action.asp"

method定義和用法

method 屬性規定如何發送表單數據(表單數據發送到 action 屬性所規定的頁面)。orm

表單數據能夠做爲 URL 變量(method="get")或者 HTTP post (method="post")的方式來發送。ci

所以上述代碼method能夠爲get也能夠是postget

相關文章
相關標籤/搜索