<input type="number" id="myNumber" value="2"><br><br> <button onclick="disableBtn()">禁用 Number 字段</button> <button onclick="undisableBtn()">启用 Number 字段</button> <script> function disableBtn() { document.getElementById("myNumber").disabled = true; } function undisableBtn() { document.getElementById("myNumber").disabled = false; } </script>