HTML DOM disabled 屬性
定義和用法
disabled 屬性可設(shè)置或返回是否應(yīng)禁用文本框。
語法
textareaObject.disabled=true|false
實(shí)例
下面的例子可禁用并啟用文本框:
<html>
<head>
<script type="text/javascript">
function disable()
{
document.getElementById('txt1').disabled=true;
}
function enable()
{
document.getElementById('txt1').disabled=false;
}
</script>
</head>
<body>
<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="disable()" value="Disable" />
<input type="button" onclick="enable()" value="Enable" />
</body>
</html>