<html>
<body>
生日: <input type="datetime" id="myDatetime" readonly>
<p>点击按钮查看 datetime 字段是否只读。</p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myDatetime").readOnly;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>