HTML的表單控件


HTML的表單控件

HTML原有的

  1. 按鈕

    < input type="button">

  2. 復選框

    < input type="checkbox">

    值可以設置為選中或者未選中

  3. 電子郵件

    < input type="email" >

    表單提交時,會驗證數據是否符號email的規范(有@,並且@后面有內容)

  4. 選擇文件

    < input type="file">

    accept屬性可以設置文件指定格式

  5. 不顯示的控件

    < input type="hidden">

    不顯示,但是值仍然會提交到服務器

  6. 帶圖像的submit按鈕

    < input type="image">

    如果src缺失,alt屬性會顯示

  7. 數字類型

    < input type="number" >

    屬性:

    • value 默認顯示的值
    • max 能接收到的最大值
    • min 能接收到的最小值
    • step 每次調整數字時,步數大小
  8. 密碼

    < input type="password">

    值會被遮蓋

  9. 單選框

    < input type="radio">

  10. 重置表單

    < input type="reset">

  11. 提交表單

    < input type="submit">

  12. 文本

    < input type="text">

    默認值,單行文本區域

  13. 周類型

    < input type="week" >

HTML5新增的

  1. 搜索類型

    < input type="search" >

    提供了快速清除的功能,輸入框有個×

  2. url類型

    < input type="url" >

    提交時,驗證數據是否符合url的規范(http://**)

  3. 電話號碼類型

    < input type="tel" >

    在移動設備中,顯示撥號鍵盤

  4. 范圍類型

    < input type="range" >

    提供一個滑塊組件,允許用戶選取指定范圍的值

    屬性:

    • value 默認顯示的值
    • max 最大值
    • min 最小值
    • step 步長
  5. 顏色類型

    < input type="color" >

    提供一個顏色拾取器

  6. 日期時間類型

    < input type="datetime-local">

  7. 時間類型

    < input type="time">

  8. 日期類型

    < input type="date" >

  9. 月份類型

    < input type="month" >


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM