<html>
<head>
<script>
function setResult()
{
document.getElementById("pwd").readOnly=true;
}
</script>
</head>
<body>
<form>
Password: <input type="password" id="pwd">
</form>
<button type="button" onclick="setResult()">Set read-only</button>
</body>
</html>