编辑下面的代码:【加编码】
<html> <body> <h3>以下实例演示了如何访问本地时间字段</h3> <input type="datetime-local" id="myLocalDate" value="2014-11-16T15:25:33"> <p>点击按钮获取 datetime-local 字段的日期与时间。</p> <button onclick="myFunction()">点我</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myLocalDate").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂