ok, ora e' chiaro,
quando setti
document.getElementById(tab).style.background="#F6 0"
e' come se nel markup scrivessi
<div id="tab" style="background:#F60">
questa e' una dichiarazione in linea, sempre piu' "forte" di qualsiasi regola in css esterno, qualora ovviamente ridefinisca le medesime proprieta'
quindi la domanda che ti poni non e' corretta: non e' il browser che da precedenza al js rispetto al css, questo e' quello che ottieni se definisci il background in linea
la soluzione del className e' corretta, anche se scomoda
codice:
<style type="text/css">
#tab {
background: #f00;
}
#tab:hover {
background: #000;
}
#tab.green {
background: #0f0;
}
</style>
<script type="text/javascript">
function nomefun(){
document.getElementById('tab').className="green"
setTimeout("document.getElementById('tab').className=null",1000) ;
}
</script>
altrimenti, continua a lavorare sul background definito come stile in linea e rimuovilo quando ritieni opportuno
codice:
function nomefun(){
document.getElementById('tab').style.background="#0f0"
setTimeout("document.getElementById('tab').style.background=null",1000) ;
}
ciao
P.s. ho editato questa risposta, in caso l' avessi gia' letta