<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>