<html>
<body>
<input type="number" id="myNumber" value="2" disabled>
<p>点击按钮查看 number 字段是否可用。 </p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myNumber").disabled;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>