topical media & game development
#javascript-code-13-change.js / js
function watchFields( form ) {
// Go through all the field elements in form
for ( var i = 0; i < form.elements.length; i++ ) {
// and attach a 'blur' event handler (which watches for a user
// to lose focus of an input element)
addEvent( form.elements[i], 'blur', function(){
// Once the focus has been lost, re-validate the field
return validateField( this );
});
}
}
// Locate the first form on the page
var form = document.getElementsByTagName( "form" )[0];
// Watch all the fields in the form for changes
watchFields( form );
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.