標籤: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>