Code
//JavaScript that looks for all elements with the tag name "input" and gives it a class called "textfield_on" when the specific input is in focus
function highlight() {
var elements = document.getElementsByTagName("input");
for (i=0; i < elements.length; i++) {
if (elements[i].type != "button" && elements[i].type != "submit" && elements[i].type != "reset") {
elements[i].onfocus=function() {this.className='textfield_on';};
elements[i].onblur=function() {this.className='textfield'};
}
}
}
window.onload = highlight;
//example of an input element
<input name="name" id="name" type="text" class="textfield" />
