/ Published in: JavaScript
The unobtrusive version requires an onload statement. Doing that in a backward-compatible fashion can be a pain in the ass. So here is an inline version for use with older code. This should work "out of the box" with any browser that has javascript.
Expand |
Embed | Plain Text
<script type="text/javascript"> var Handler = { clearedOnce : false, clear : function ( field ) { if (this.clearedOnce == false) { field.value = ''; this.clearedOnce = true; } } } </script> <!-- then in the XHTML: --> <input onfocus="Handler.clear(this)" value="foobar" />
You need to login to post a comment.
