表单元素格式 属性说明type指定元素的类型。text、password、 checkbox、 radio、submit、reset、file、hidden、image 和button,默认为textname指定表单元素的名称value元素的初始值。type为radio时必须指定一个值size指定表单元素的初始宽度。当type为text 或password时,表单元素的大小以字符为单位。对于其他类型,宽度以像素为单位maxlengthtype为text或password时,输入的最大字符数checkedtype为text或password时,指定按钮是否是被选中 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>登录注册</title> </head> <body> <h1>注册</h1> <!--表单form action:表单提交的位置,可以是网站,也可以是一个请求处理地址 method:post,get提交方式 get方式提交:我们可以在url中看到我们提交的信息,不安全,高效 post:比较安全,传输大文件 --> <form method="post" action="6.表格.html" > <!--文本输入框 value="" 默认初始值 maxlength="8" 最长能写几个字符 size="30" 文本框的长度 --> <p>名字:<input type="text" name="username" maxlength="8" size="30"></p> <p>密码:<input type="password" name="pwd" maxlength="20" size="30"></p> <!--单选框标签 input type="radio" value:单选框的值 name:表示组 --> <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>