H5新增表單

2021-10-13 07:25:12 字數 1339 閱讀 7046

新增表單型別如下:

屬性值說明type=「email」

限制使用者輸入必須為email型別

type=「url」

限制使用者輸入必須為url型別

type=「date」

限制使用者輸入必須為日期型別

type=「time」

限制使用者輸入必須為時間型別

type=「month」

限制使用者輸入必須為月型別

type=「week」

限制使用者輸入必須為周型別

type=「number」

限制使用者輸入必須為數字型別

type=「tel」

手機號碼(不限制只能輸入數字,因為有些特殊**會有符號)

type=「search」

搜尋框type=「color」

生成乙個顏色選擇表單

**:

ul li 

input[type=

'email']:

:-webkit-input-placeholder

input[type*=

'e']

<

/style>

"">

**:"url"

>

<

/li>

郵箱:"email" placeholder=

"hello world"

>

<

/li>

日期:"date"

>

<

/li>

時間:"time"

>

<

/li>

月份:"month"

>

<

/li>

週期:"week"

>

<

/li>

數字:"number"

>

<

/li>

**:"tel"

>

<

/li>

搜尋:"search" autocomplete=

"on" name=

"search"

>

<

/li>

顏色:"color"

>

<

/li>

"file" multiple>

"submit"

>

<

/li>

<

/ul>

<

/form>

效果圖如下:

H5新增表單屬性

一 form屬性 14 最後乙個input並不屬於form表單元素,在提交表單是,input不會隨著表單一起提交,但是在html5中我們只需要在input屬性中增加form屬性,並制定form的id,外部的input就屬於表單的提交範圍.二 formaction屬性 1 可以將表單元素提交到不同的頁...

H5新增input表單 表單屬性

新增表單 屬性值說明 type email 郵箱格式 type url url型別 type date 日期格式 type time 時間格式 type month 月type week 周type number 數字type tel 手機號type seach 搜尋框type color 顏色選擇...

H5新增input表單 表單屬性

新增表單 表單屬性 required required,必填,內容不能為空 placeholder 提示文字 佔位符 更改提示文字顏色 input placeholder autofocus autofocus,自動聚焦到指定表單 multiple multiple,可以多選檔案提交 多用於上傳檔案...