這篇“html5表單常用屬性實例分析”文章的知識點大部分人都不太理解,所以小編給大家總結了以下內容,內容詳細,步驟清晰,具有一定的借鑒價值,希望大家閱讀完這篇文章能有所收獲,下面我們一起來看看這篇“html5表單常用屬性實例分析”文章吧。
html5新的表單增加了很多常用屬性,使代碼編寫更加容易,不需要其他js插件,只需將驗證屬性配置在html代碼中就可以完成表單驗證。
以下是表單常用的驗證html代碼:
頁面代碼:
<!DOCTYPE html>
<html>
<頭>
<meta charset =“ UTF-8” />
<title> </ title>
</ head>
<script type =“ text / javascript”>
函數showValue(o)
{
document.forms [“ form1”] [“ sum”]。value = o.value;
}
</ script>
<身體>
<form action =“” method =“ POST” id =“ form1” name =“ form1”>
<input type =“ text” autofocus =“ autofocus”必需的樣式=“ [Az] {3}” name =“ auto”占位符=“必填項測試” />
數字:<input type =“ number” name =“ demoNumber” min =“ 1” max =“ 100” step =“ 2” />
郵箱:<input type =“ email” placeholder =“請輸入郵箱” name =“ mail” />
<input type =“ url” name =“ url” placeholder =“輸入正確的網址” />
<br />
日期:<input type =“ date” name =“ time” />
顏色:
<input type =“ color” name =“ color” /> <br />
<br />
<input type =“ range” min =“ 0” max =“ 50” step =“ 5” name =“ rangedemo” value =“ 0” onchange =“ showValue(this)” />
<output name =“ sum”> 0 </ output>
<br />
<input type =“ submit” value =“提交表單” />
</ form>
</ body>
</ html>
以上就是關于“html5表單常用屬性實例分析”這篇文章的內容,相信大家都有了一定的了解,希望小編分享的內容對大家有幫助,若想了解更多相關的知識內容,請關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。