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