fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> 生日: <input type="datetime-local" id="myLocalDate" name="bdaytime"> <p>点击按钮显示或者修改本地时间的 name 属性值。</p> <button onclick="display()">显示名称</button> <button onclick="change()">修改名称</button> <script> function display() { var x = document.getElementById("myLocalDate").name; alert("本地时间字段名称为: " + x); } function change() { var x = document.getElementById("myLocalDate").name = "newDatetimeName"; alert ("名称修改为: " + x); } </script> </body> </html>
运行结果