html5 表單 內建驗證

來源:互聯網
上載者:User

標籤:lis   legend   length   highlight   ace   conf   etc   focus   action   


 
required="required" 必填
 placeholder="xxx-xxxx-xxxx" // 提示
pattern="\d{3}-\d{4}-\d{4} //正則匹配
 autofocus    // 指標

 <fieldset>                  <legend>Expectations:</legend> // 提示:<legend> 標籤為 <fieldset> 元素定義標題。             </fieldset>  //
 

<form name="register1" id="register1" method="post" action="/" > <p><label for="runnername">RunnerName:</label> <input id="runnername" name="runnername" type="text" placeholder="First and last name" required="required" autofocus/>
</p> <p><label for="phone">Tel #:</label> <input id="phone" name="phone" type="text" pattern="\d{3}-\d{4}-\d{4}" required="required" placeholder="xxx-xxxx-xxxx"/></p> <p><label for="emailaddress">E-mail:</label> <input id="emailaddress" name="emailaddress" type="email" required="required" placeholder="For confirmation only"/></p> <p><label for="dob">DOB:</label> <input id="dob" name="dob" type="date" placeholder="MM/DD/YYYY"/></p> <p>Count:<input type="number" id="count" name="count" min="0" max="100" step="10"/></p> <p><label for="style">Shirt style:</label> <input id="style" name="style" type="text" list="stylelist" title="Years of participation" autocomplete="off"/></p> <datalist id="stylelist"> <option value="White" label="1st Year"/> <option value="Gray" label="2nd - 4th Year"/> <option value="Navy" label="Veteran (5+ Years)"/> </datalist> <fieldset> <legend>Expectations:</legend> <p> <label for="confidence">Confidence:</label> <input id="confidence" name="level" type="range" onchange="setConfidence(this.value)" min="0" max="100" step="5" value="0"/> <span id="confidenceDisplay">0%</span></p> <p><label for="notes">Notes:</label> <textarea id="notes" name="notes" maxLength="100"></textarea></p> </fieldset> <p><input type="submit" name="register" value="Submit" onclick=" checkForm()"/></p> </form>

 

    

  

<form name="register1" id="register1">          <p><label for="runnername">RunnerName:</label>             <input id="runnername" name="runnername" type="text" placeholder="First and last name" required="required" autofocus/>          </p>          <p><label for="phone">Tel #:</label>             <input id="phone" name="phone" type="text" pattern="\d{3}-\d{4}-\d{4}"                  required="required"  placeholder="xxx-xxxx-xxxx"/></p>          <p><label for="emailaddress">E-mail:</label>             <input id="emailaddress" name="emailaddress" type="email"                    required="required" placeholder="For confirmation only"/></p>          <p><label for="dob">DOB:</label>                         <input id="dob" name="dob" type="date"        placeholder="MM/DD/YYYY"/></p>          <p>Count:<input type="number" id="count" name="count" min="0" max="100" step="10"/></p>          <p><label for="style">Shirt style:</label>               <input id="style" name="style" type="text" list="stylelist" title="Years of participation"                 autocomplete="off"/></p>            <datalist id="stylelist">             <option value="White" label="1st Year"/>             <option value="Gray" label="2nd - 4th Year"/>             <option value="Navy" label="Veteran (5+ Years)"/>            </datalist>                    <fieldset>            <legend>Expectations:</legend>            <p>            <label for="confidence">Confidence:</label>            <input id="confidence" name="level" type="range"                   onchange="setConfidence(this.value)"                   min="0" max="100" step="5" value="0"/>            <span id="confidenceDisplay">0%</span></p>            <p><label for="notes">Notes:</label>               <textarea id="notes" name="notes" maxLength="100"></textarea></p>         </fieldset>          <p><input type="submit" name="register" value="Submit" onclick=" checkForm()"/></p>        </form>
    

 

html5 表單 內建驗證

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.