1 <!--menthod 表示提交的方式,不写默认为get--> 2 <!-- action 表示向何处提交数据--> 3 <form method="post" action="index2.html"> 4 5 <p>用户名:<input name = "username" type="text"></p> 6 <p>密 码 : <input name = "userpass" type="password"></p> 7 <input type = "submit" name = "Button" value="登录"> 8 <input type="reset" name = "Reset" value = "清空" /> 9 <!--在实际开发中,通常使用post提交表达数据--> 10 11 <!--input 表示可以输入内容的内容框--> 12 <!-- type 表示内容框的类型 name 表示框的名字,随意起 value 表示直接显示在框中的值--> 13 <input type="text" name = "name" value="text" /> 14 15 </form>

1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 </head> 7 <body> 8 <form action="index2.html"> 9 10 <!--text 文本格式--> 11 <!--maxlength 表示type为text 或 password 时,输入的最大字符数--> 12 账号:<input type ="text" name = "username" maxlength="6" /><br> 13 14 <!--password 密码格式--> 15 <!--size 表示指定表单元素的初始宽度。 16 当 type 为 text 或 password时,表单元素的大小以字符为单位。 17 对于其他类型,宽度以像素为单位--> 18 密码:<input type = "password" name = "userpass" size="20" /><br> 19 20 <!--redio 单选格式(需要name相同)--> 21 <!--checked 表示type为radio或checkbox时,指定按钮是否是被选中--> 22 <!--value 表示元素的初始值。type 为 radio时必须指定一个值--> 23 性别:<input type = "radio" name="sex" value = "man" checked="checked"/>男 24 <input type = "radio" name="sex" value = "wuman"/>女 25 <br> 26 27 <!--select(选择) 下拉框--> 28 省份:<select> 29 30 <!--option 表示下拉框里的内容--> 31 <option>河南省</option> 32 <option>河北省</option> 33 <option>广东省</option> 34 </select> 35 城市:<select> 36 <option>郑州市</option> 37 <option>信阳市</option> 38 <option>石家庄</option> 39 <option>保定市</option> 40 <option>东莞市</option> 41 <option>广州市</option> 42 </select> 43 <br> 44 45 <!--checkox(多选框) 表示复选框--> 46 爱好:<input type = "checkbox" />打篮球 47 <input type="checkbox" />听音乐 48 <input type="checkbox" />跑步 49 <input type="checkbox" />踢足球 50 <br /> 51 52 <!--file 表示选择文件上传--> 53 <input type="file" /> 54 <br> 55 56 <!--submit 提交按钮--> 57 <input type="submit" value="提交"/> 58 59 <!--reset 重置按钮--> 60 <input type="reset" value="重置"/> 61 62 <!--image 表示图片提交按钮 src 图片地址--> 63 <input type="image" value="提交" src=""/> 64 65 <!--隐藏域,用户看不到的信息--> 66 <input type="hidden" /> 67 68 <!--button 普通按钮--> 69 <input type="button" value="普通按钮"/> 70 </form> 71 </body> 72 </html>
原文:https://www.cnblogs.com/liuwenchuang/p/14736812.html