Hi to all,
I have given the code which is used to change the field type from text to password. In login page, we need to display “Enter the password” in password field, it should be visible and same time while user type on it, automatically visible in password format.
input name=”password” type=”text” id=”password” value=”Enter the password” class=”txtbox1″ onfocus=”if(this.value == ‘Enter the password’) {this.value=”; replaceThis(this);}” onblur=”if(this.value == ”) { this.value=’Enter the password’;replaceThis(this);}”
function replaceThis(obj)
{
if(obj.getAttribute(‘type’)==’text’)
{
obj.setAttribute(‘type’,'password’);
}else{
obj.setAttribute(‘type’,'text’);
}
obj.focus();
}