W3School TIY
脚 本 学 堂 www.jbxue.com
编辑您的代码:
<html> <head> <script type="text/javascript"> function makeReadOnly() { document.getElementById("text1").readOnly=true } </script> </head> <body> <form> <input type="text" id="text1" value="Hello World!" /> <input type="button" onclick="makeReadOnly()" value="Make read-only" /> </form> </body> </html>
查看结果: