编辑下面的代码:【加编码】
<html> <body> 姓: <input type="text" id="myText" value="Mickey"><br> <button onclick="disableTxt()">禁用文本域</button> <button onclick="undisableTxt()">启用文本域</button> <script> function disableTxt() { document.getElementById("myText").disabled = true; } function undisableTxt() { document.getElementById("myText").disabled = false; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂