提交數據
我們在表單上填的信息很多情況下需要提交到後臺。
<input>的[type]屬性值爲“submit”時,表示提交表單數據。它在頁面的表現形式也是個按鈕,點擊該按鈕,表單數據將會提交給服務器。
<button>標籤也具有[type]屬性,在表單中,<button>(除了 在Internet Explorer中)默認行爲是提交表單,與type="submit"的<input>標籤一樣。Internet Explorer 中<button>的默認行爲是一個普通的按鈕。
<button>標籤[type]屬性值爲"reset"與<input>標籤type="reset"相當。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="index.css">
<title>表單</title>
</head>
<body>
<form action="/" method="get">
<h2>input標籤 -- 提交數據</h2>
<p><label for="account">賬號:</label><input type="text" id="account"/></p>
<p><label for="psd">密碼:</label><input type="password" id="psd"/></p>
<input type="submit" value="提交">
</form>
</body>
</html>
更多學習內容,就在碼芽網http://www.mayacoder.com/lesson/index