Just refactored the input watermarking script, of course it is still **XHTML** 1.0 transitional and **WCAG** priority 1,2 valid.
JavaScript:
var values = new Array();
var inputs = new Array();
function addWaterMark(el){
try {
values.push(el.value);
el.addEvent('focus',function(){
if (el.value === values[inputs.indexOf(el)]){el.value = ''};
});
el.addEvent('blur',function(){
if(this.value === ''){el.value = values[inputs.indexOf(el)]};
});
} catch(e) {dbug.log('addWaterMark: ', e)}
};
window.addEvent('domready', function(){
inputs = $$('input.watermark');
inputs.each(addWaterMark);
});
Usage: Just put value on you inputs and use class=”watermark”
As usual example