x
 
<!DOCTYPE html>
<html>
<body>
<input type="datetime-local" id="myLocalDate"><br><br>
<button onclick="disableBtn()">禁用本地日期时间字段</button>
<button onclick="undisableBtn()">取消禁用本地日期时间字段</button>
<p><b>注意:</b>type="datetime-local" 的输入元素在 Firefox 中不会显示为任何日期时间字段/日历。</p>
<script>
function disableBtn() {
  document.getElementById("myLocalDate").disabled = true;
}
function undisableBtn() {
  document.getElementById("myLocalDate").disabled = false;
}
</script>
</body>
</html>