1_新增表单元素.html 1015 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <form action="xxx.php">
  10. <input type="text">
  11. <!-- 数字文本框 -->
  12. <input type="number" max="10" min="1" step="2">
  13. <input class="color-inp" type="color">
  14. <input type="date">
  15. <!-- <input type="datetime"> -->
  16. <input id="range-inp" type="range">
  17. <!-- <input name="phone" type="tel"> -->
  18. <input type="url">
  19. <input type="email">
  20. <button id="btn" type="">按钮</button>
  21. </form>
  22. <script>
  23. var oId = document.getElementById("btn");
  24. var oColor = document.getElementsByClassName("color-inp")[0];
  25. var rangeInp = document.getElementById("range-inp");
  26. oId.onclick = function () {
  27. // console.log(oColor.value)
  28. console.log(rangeInp.value);
  29. }
  30. </script>
  31. </body>
  32. </html>