This script is little. But it is very useful. I use it in nearly every form I make!
Code:
onclick="javascript:this.value='';" onblur="javascript:if(this.value==''){this.value=this.getAttribute('value');}"
That's it!
It even works with password boxes, with this script:
Code:
onclick="javascript:this.value='';this.type='password';" onblur="javascript:if(this.value==''){this.value=this.getAttribute('value');this.type='text';}"
I believe the password one doesn't work with IE, though.
Simply add this to an input box with a value set, and when the user clicks on it, it will disappear, and if it's left as nothing when they deselect the box, it goes back to the original!
Last edited by Physicsguy; 07-07-2010 at 10:40 AM..
|