<!DOCTYPE html> <html> <body> <input type="datetime-local" id="myLocalDate"> <p>单击该按钮可返回本地日期时间字段是哪种类型的表单元素。</p> <button onclick="myFunction()">试一试</button> <p><b>注意:</b>type="datetime-local" 的输入元素在 Firefox 中不会显示为任何日期时间字段/日历。</p> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myLocalDate").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>