Questo è uno script per il focus sui campi di un form
window.onload=function(){
if(document.getElementsByTagName)
Focus();
}
function Focus(){
var inp=document.getElementsByTagName("input");
var inp2=document.getElementsByTagName("textarea");
for(i=0;i<inp.length;i++){
inp[i].onfocus=function(){this.style.backgroundColor="#E CE6F9"; this.style.borderColor="#333"};
inp[i].onblur=function(){this.style.backgroundColor="#FF F"; this.style.borderColor="#999"};
}
for(i=0;i<inp2.length;i++){
inp2[i].onfocus=function(){this.style.backgroundColor="#E CE6F9"; this.style.borderColor="#333"};
inp2[i].onblur=function(){this.style.backgroundColor="#FF F"; this.style.borderColor="#999"};
}
}
Il problema è che con "input" mi prende anche i pulsanti che invece non centrano. Campi e pulsanti sono però in Div differenti, come faccio a rendere la distinzione?
document.che ce metto?.getElementsByTagName("input");
il div che racchiude i campi è una classe