表單: 表單是指HTML標籤,利用瀏覽器它可以在互聯網站上收集信息。表單可包括文本字段、tick boxes和下拉式菜單。
ex.搜索框、登入....
主要的元素:
<form>:用於創建表單
屬性:method,如何發送data
action,提交表單時向何處發送數據
<input>:蒐集信息
其包含的屬性:
| type | 後面可以輸入各同不同屬性,可以來定義出說這個裱框是什麼東西 | 密碼<input type="password" >、選框<input type="checkbox"> |
| value | 預設字符 | <input type="text" value="我是個網站"> |
| placeholder | 提供可描述輸入字段預期值的提示信息(hint)。該提示會在輸入字段為空時顯示,並會在字段獲得焦點時消 | <input type="text" placeholder="我是個網站" > |
| maxlength | 設定可以輸入字符的長度 | <input type="text" maxlength="8" > |
| button | 按鈕標籤 |
<input type= button value ="按鈕" >(通常用於與js作事件的處理) <button>按鈕</button> (這個適用的範圍可以更廣泛) |
| submit | 提交表單標籤 |
,<input type "submit" value ="提交" > (最好添加method和action屬性) |
| range | 滑表 | <input type= "range" > |
| number | 一個可以輸入數字的輸入欄 | <input type= "number" > |
| checkbox | 一個選擇扭如要不要記住密碼、要不要選擇 | <input type= "checkbox" >選擇 |
| radio | 產生一個固定選像(選了就不能取消) | <input type= "radio" >選項 |
| select | 選像列表 |
<select> <option></option> </select> |
| file | 檔案 | <input type= "file" > |
| 驗證郵箱地址 | <input type= "email" > | |
| url | 驗證url | <input type= "url" > |
| date | 獲取時間 | <input type= "date" > |
| color | 獲取顏色值 | <input type= "color" > |
| search | 搜索框 | <input type= "search" > |
還有很多的不同屬性能使用,可以去找標籤表來試試
文章標籤
全站熱搜
