<html>
<body>
<input type="month" id="myMonth" readonly>
<p>单击按钮可查看月份字段是否为只读。</p>
<button onclick="myFunction()">试一试</button>
<p><b>注意:</b>type="month" 的输入元素在 Firefox 中不会显示为任何日期字段/日历。</p>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myMonth").readOnly;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>