表单元素格式
属性 | 说明 |
---|
type | 指定元素的类型。text、password、 checkbox、 radio、submit、reset、file、hidden、image 和button,默认为text |
name | 指定表单元素的名称 |
value | 元素的初始值。type为radio时必须指定一个值 |
size | 指定表单元素的初始宽度。当type为text 或password时,表单元素的大小以字符为单位。对于其他类型,宽度以像素为单位 |
maxlength | type为text或password时,输入的最大字符数 |
checked | type为text或password时,指定按钮是否是被选中 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录注册</title>
</head>
<body>
<h1>注册</h1>
<form method="post" action="6.表格.html" >
<p>名字:<input type="text" name="username" maxlength="8" size="30"></p>
<p>密码:<input type="password" name="pwd" maxlength="20" size="30"></p>
<p>性别:
<input type="radio" value="boy" name="sex"/>男
<input type="radio" value="girl" name="sex"/>女
<input type="radio" value="unknown" name="sex"/>未知
</p>
<p>
<input type="submit">
<input type="reset">
</p>
</form>
</body>
</html>
