HTML&CSS基础学习笔记1.26-input标签重置表单

时间:2022-11-18 22:59:51

重置表单

<input>的[type]属性值为"button"的时候表示一个普通的按钮,相当于一个<button>标签。


<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="reset" value="重置">
</form>
</body>
</html>
更多学习内容,就在码芽网http://www.mayacoder.com/lesson/index

结果是这样的:

HTML&CSS基础学习笔记1.26-input标签重置表单
重置后:

HTML&CSS基础学习笔记1.26-input标签重置表单