HTML5學習之智能表單(二)

來源:互聯網
上載者:User

標籤:style   blog   http   color   java   使用   os   io   

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title></title></head><body>    <form action="文檔結構和語義.html" method="post" oninput="updateSum();">        <!--tabindex tab鍵切換的優先順序 -->        普通文字框<input type="text" tabindex="1" pattern="[a-z]{3,32}" />        <!--pattern Regex驗證-->        <br />        一行文本<input type="tel" tabindex="3" /><br />        一行文本<input type="search" autofocus list="searchList" tabindex="2" />        <datalist id="searchList">            <option>aaa</option>            <option>bbb</option>        </datalist>        <br />        絕對URL地址<input type="url" /><br />        有效e-mail地址<input type="email" placeholder="[email protected]" required  id="email" /><br />        日期及時間(使用UTC時間)<input type="datetime" /><br />        不帶時區的日期<input type="date" min="2010-08-01" max="2010-11-11" step="7" />        <!--step=“7” 在min日期上以7天為單位增減-->        <br />        不帶時區的月份<input type="month" /><br />        不帶時區的年及周<input type="week" /><br />        不帶時區的時間<input type="time" min="14:30" max="19:30" step="3600" /><br />        時區的當期日期及時間<input type="datetime-local" /><br />        數字<input type="number" max="1" min="0" step="0.1" /><br />        一定範圍內的數值<input type="range" /><br />        十六進位RGB值<input type="color" /><br />        <!--圖形化表示已知範圍內的測量標準,比如車子裡的油表-->        <meter value="0.5"></meter>        <progress value="3" max="10"></progress>                        price:<input type="number"  id="price"/> quantity:<input type="number" id="quantity" />        <output name="sum" id="sum" for="price quantity"></output><!--輸出updateSum()計算的值 -->        <input type="submit" name="name" value="提交" />    </form>    <script type="text/javascript">        function updateSum() {            document.getElementById("sum").value = parseFloat(document.getElementById("price").value) * parseFloat(document.getElementById("quantity").value);        };        window.onload = function () {            //document.getElementById("email").addEventListener("invalid", function () {            //    this.style.border = "dotted 2px red";            //});            document.getElementById("email").onchange = function() {                if (!this.checkValidity()) {                    this.style.border = "dotted 2px red";                } else {                    this.style.border = "";                }            };            alert(document.querySelectorAll(":required")[0].tagName); //input            alert(document.getElementById("email").nextSibling.tagName);// br                  };    </script>   </body></html>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.