
Originally Posted by
Twey
Code:
<input
type="text"
onfocus="this.value === this.defaultValue && (this.value = '');"
onblur="this.value = this.value || this.defaultValue;"
name="search"
value="keyword search"
>
that would be a *beep* to type out every time.
Code:
<script type="text/javascript">
function clearDefault(el) {
if (el.defaultValue==el.value) el.value = ""
}
function restoreDefault(el) {
if (el.value!=el.defaultValue || el.value="")el.value = el.defaultValue
}
</script>
Code:
<input type="text" name="something" onfocus="clearDefault(this)" onblur="restoreDefault(this)">
Bookmarks