1. <span style="font-size:24px;"><!DOCTYPE html>
    2. <!--
    3. To change this license header, choose License Headers in Project Properties.
    4. To change this template file, choose Tools | Templates
    5. and open the template in the editor.
    6. -->
    7. <html>
    8. <head>
    9. <title>表单输入框的类型</title>
    10. <meta charset="UTF-8">
    11. <meta name="viewport" content="width=device-width">
    12. </head>
    13. <body>
    14. <!--对于整个表单来说有很多浏览器自带的属性我们在写网站的时候需要去除默认的,写自己的一些属性 + novalidate为tue表示整个表单将不采用默认验证
    15. + enctype 设置是表示数据发送到服务器之前如何对表单数据进行编码(上传文件的表单使用multipart/form-data + text/plain只对特殊的字符编码 + application/x-www-form-urlencoded对所有的进行编码)
    16. -->
    17. <form name="inputTypeForm" id="typeForm" novalidate="true" enctype="text/plain">
    18. <!--最常用的输入框的类型 + autofocus属性用于表单自动获得焦点 + pattern支持表单自定义正则表达式验证 + required必填项用required控制-->
    19. <input type="text" name="name" autofocus="autofocus" pattern="[A-z]{3}" required="required">
    20. <!--主要用于输入密码会隐藏显示的内容-->
    21. <input type="password" name="pass">
    22. <!--显示button按钮-->
    23. <input type="button" name="确定">
    24. <!--表单的提交按钮 + formnovalidate为true时是对该项免去浏览器默认的验证 + formaction存在值得时候是对当前的表单重新选择提交路径-->
    25. <input type="submit" value="提交" formnovalidate="true" formaction="demo_admin.asp" >
    26. <!--重置表单的按钮-->
    27. <input type="reset" value="重置">
    28. <!--单选按钮让用户只选其一-->
    29. <input type="radio" name="sex" value="man">
    30. <input type="radio" name="sex" value="woman">
    31. <!--表单的多选框-->
    32. <input type="checkbox" name="white" value="white">
    33. <input type="checkbox" name="blue" value="blue">
    34. <!--用于定义隐藏字段-->
    35. <input type="hidden" name="city" value="city">
    36. <!--用于用户选择文件上传 + multiple 支持多选、默认情况下是单选-->
    37. <input type="file" multiple="multiple">
    38. <!--不提倡使用type=image作为表单的提交按钮要结合alt src使用。提交时会将按钮的x/y坐标提交上去 + width、height是css3新加的属性 -->
    39. <input type="image" src="http://demo.jb51.net/js/2015/jquery_lunbo/images/4.jpg" alt="submit" width="99" height="99">
    40. <!--新增控件类型 下面是html5新加的表单类型,使得html更加的强大 可以设置最小值、最大值和每次点击跳的步数-->
    41. <input type="number" min="0" max="10" step="3">
    42. <!--自带的邮箱输入框已经做好了验证-->
    43. <input type="email" placeholder="请输入邮箱">
    44. <!--如果想要输入一个连接通过url来控制-->
    45. <input type="url" placeholder="请输入链接">
    46. <!--可以选择颜色-->
    47. <input type="color" placeholder="请选择颜色">
    48. <!--可以选择范围-->
    49. <input type="range" placeholder="请选择范围">
    50. <!--日期的选择当然时间这块的类型有点多 date/month/week/time/datetime-->
    51. <input type="date" placeholder="请选择时间">
    52. <!--html5新加的列表标签、更形象化 相当于自己封装了一个select-->
    53. <datalist id="url_list">
    54. <option label="W3Schools" value="http://www.w3school.com.cn" />
    55. <option label="Google" value="http://www.google.com" />
    56. <option label="Microsoft" value="http://www.microsoft.com" />
    57. </datalist>
    58. </form>
    59. <!--在form表单之外但是一样是属于id为typeForm的表单 + 但所属为多个form的时候各个id用空格分割开-->
    60. <input type="text" name="nickname" form="typeForm">
    61. </body>
    62. </html></span>