﻿// Highlighting form field// onKeyUp="highlight(event)" onClick="highlight(event)" - Must be prresent in form tagvar highlightcolor="lightblue" // Input type color controlvar ns6=document.getElementById&&!document.allvar previous=''var eventobj// Input types allowedvar intended=/INPUT|TEXTAREA|SELECT|OPTION/// Click controlfunction checkel(which){if (which.style&&intended.test(which.tagName)){if (ns6&&eventobj.nodeType==3)eventobj=eventobj.parentNode.parentNodereturn true}elsereturn false}// Highlight controlfunction highlight(e){eventobj=ns6? e.target : event.srcElementif (previous!=''){if (checkel(previous))previous.style.backgroundColor=''previous=eventobjif (checkel(eventobj))eventobj.style.backgroundColor=highlightcolor}else{if (checkel(eventobj))eventobj.style.backgroundColor=highlightcolorprevious=eventobj}}