简单教程
提交运行
代码编辑器:
姓: <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>
运行结果: