Node.js examples for HTML:Form
Highlight Form Elements
function highlightFormElements() { // add input box highlighting addFocusHandlers(document.getElementsByTagName("input")); addFocusHandlers(document.getElementsByTagName("textarea")); } function addFocusHandlers(elements) { for (i=0; i < elements.length; i++) { if (elements[i].type != "button" && elements[i].type != "submit" && elements[i].type != "reset" && elements[i].type != "checkbox" && elements[i].type != "radio") { if (!elements[i].getAttribute('readonly') && !elements[i].getAttribute('disabled')) { elements[i].onfocus=function() {this.style.backgroundColor='#ffd';this.select()}; elements[i].onmouseover=function() {this.style.backgroundColor='#ffd'}; elements[i].onblur=function() {this.style.backgroundColor='';} elements[i].onmouseout=function() {this.style.backgroundColor='';} }//from w w w . j a v a 2 s. c o m } } }