A Poorly Implemented Dynamic Label
This Dynamic Label script is an example of how not to write DHTML. It relies on the following code:
onfocus="if ('Username' == this.value) this.value = '';"
onblur="if ('' == this.value) this.value = 'Username';"
It exibits several problems including:
- Coupling to code which processes the form (press Submit without entering a username for an example of this)
- Exclusively binds to elements' event handlers
- Non-modular design; each label must be re-implemented with "copy and paste" coding