var s = document.getElementById("key"); s.onfocus = function() { if(this.value == this.defaultValue)this.value = '' };