<html>
<body>
时间: <input type="time" id="myTime" name="usr_time">
<p>点击按钮显示或修改 time 字段 name 属性的名称。</p>
<button onclick="display()">显示名称</button>
<button onclick="change()">修改名称</button>
<script>
function display() {
var x = document.getElementById("myTime").name;
alert("time 字段的名称为: " + x);
}
function change() {
var x = document.getElementById("myTime").name = "newTimeName";
alert ("名称修改为: " + x);
}
</script>
</body>
</html>