运行 ❯
获取您的
自有
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <input type="number" id="myNumber" value="2" readonly> <p>Click the button to find out if the number field is read-only or not.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { let x = document.getElementById("myNumber").readOnly; document.getElementById("demo").innerHTML = x; } </script> </body> </html>