<h3>以下实例演示了如何访问日期字段</h3> <input type="date" id="myDate" value="2014-02-09"> <p>点击按钮获取日期字段的日期。</p> <button onclick="myFunction()">点我</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myDate").value; document.getElementById("demo").innerHTML = x; } </script>