readOnly 属性可设置或返回密码域是否为只读。
passwordObject.readOnly=true|false
下面的例子把密码域设置为只读:
<html>
<head>
<script type="text/javascript">
function makeReadOnly()
{
document.getElementById("password1").readOnly=true
}
</script>
</head>
<body>
<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" onclick="makeReadOnly()"
value="Make read-only" />
</form>
</body>
</html>