HTML&CSS基础学习笔记1.27-input提交数据

时间:2023-03-08 15:53:18

提交数据

我们在表单上填的信息很多情况下需要提交到后台。

<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>