私はonclickとonfocusの間にHTML要素の型を変更するために以下のコードを使用しています。IEのブラウザで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とIE7とIE8.itが
のようなエラーが "typeプロパティを取得できませんでした:このコマンドはサポートされていません" と表示され動作していないONFOCUS
をどうすれば解決できますか?
value属性を偽の「