onclickおよびonfocus中にHTML要素のタイプを変更するために、以下のコードを使用しています。
function ChangeToPassField() {
document.getElementById('password').type="password";
document.getElementById('password').focus();
}
<input type="text" name="password" id="password" onblur="ChangeToTextField(); if (this.value == '') {this.value = 'Password';}" onclick="ChangeToPassField(); if (this.value == 'Password') { this.value = ''; } else { this.value; }" onfocus="if (this.value == 'Password') { this.value=''; }; this.type='password';" value="Password" style="width:230px; height:25px; margin-left:5px; background:none; border:0px;" />
イベント onclick および onfocus が動作しない IE7 および IE8.it のようなエラーが表示されます
「タイプ プロパティを取得できませんでした: このコマンドはサポートされていません」
どうすればこれを解決できますか?