I doesn't seem to matter how you access the text input (as a part of a form or as a document element or as part of the document.all collection), or whether you use the setAttribute() method or just assign the value directly. IE for some reason just doesn't like this. I found a work around that FF also will happily use:
Code:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function passit(ip){
var np=ip.cloneNode(true);
np.type='password';
ip.parentNode.replaceChild(np,ip);
}
</script>
</head>
<body>
Hi<br><button style="cursor:pointer;" onclick="passit(document.getElementById('test'));">Pword It</button>
<input id="test" type="text">
</body>
</html>
BTW, since IE 5, IE has been just fine with getElementById.
Bookmarks