Currently, I am working on the login section of my website and I would like to implement a similar effect to Twitter's login form, where the Username and Password values disappear when the Textfield and Password field are in focus. I have attempted to achieve this using plain JavaScript with the following code...
function PasswordClick(evt) {
if ("Password" === this.value) this.value = "";
if(this.getAttribute('type')=='text')
{
this.setAttribute('type','password');
}
this.focus();
}
However, I have encountered issues with this approach in Chrome 12.0.742.100 on Windows and other web-kit browsers, although it seems to work fine on Firefox.
Does anyone have a more effective solution for implementing this feature?
Thank you in advance.