Hey all. I'm working on some VERY big forms, and the user will easily
lose their location if they get distracted - which happens a lot with
the amount of phone traffic they get.
Anyway, I have a function like this:
function initForms(){
for(i = 0; i < document.forms.length; i++){
for(j = 0; j < document.forms[i].elements.length; j++){
el = document.forms[i].elements[j]
el.onFocus = fldBGChange;
el.onBlur = fldBGChange();
}
}
}
function fldBGChange(){
bgClr = this.style.backgroundColor;
if(bgClr == fldBlurBG || bgClr == '' || bgClr == null){
this.style.backgroundColor = 'yellow';
} else {
this.style.backgroundColor = 'white';
}
}
Now, the idea is that when a user focuses on a field, it turns the
background yellow. However, this doesn't actually happen. Is there any
way to normalize the onFocus and onBlur events as opposed to adding
them to each field? Thanks for your help!