我正在使用以下代码将输入文本字段交换到焦点密码区域。
<input type="text" name="password" id="password" onblur="ChangeToTextField(); if (this.value == '') {this.value = 'password';}" onfocus="ChangeToPassField(); if (this.value == 'password') { this.value = '';}else { this.value; }" value="password" style="width:230px; height:25px; margin-left:5px; background:none; border:0px;" />
<script type="text/javascript">
function ChangeToPassField() {
document.getElementById('password').type="password";
var input = document.getElementById('password');
input.focus();
}
function ChangeToTextField() {
if(document.getElementById('password').value=="" || document.getElementById('password').value == "password" )
{
//alert("hai");
document.getElementById('password').type="text";
document.getElementById('password').value="password";
}
}
</script>
如果我单击密码字段,则光标不会在密码字段中闪烁。如何在密码字段中显示光标指针?...