Påvirker inputs med class="inpbg"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Ingen titel</title>
<script type="text/javascript">
window.onload=function(){
inpcolor();
}
function inpcolor(){
inps=document.getElementsByTagName("input");
for(i=0;i<inps.length;i++){
if(inps[i].className=="inpbg"){
inps[i].onfocus=function(){
this.style.background="#ff0";
this.style.border="3px solid #f00";
}
inps[i].onblur=function(){
this.style.background="#fff";
this.style.border="1px solid #000";
}
}
}
}
</script>
<style type="text/css">
input{border:1px solid #000;}
</style></head>
<body>
<input type="text" name="a">
<input type="text" name="b" class="inpbg">
<input type="text" name="c" class="inpbg">
<input type="text" name="d" class="inpbg">
<input type="text" name="e">
</body></html>