按楼主的意思<div id="all" style=" border:1px solid #000000"> 
<div style="display:inline; width:50px">123 </div> 
<div style="display:inline; width:50px">456 </div> 
<div style="display:inline; width:50px">789 </div> 
</div>
<script>
function change_tab(){
var all = document.getElementById('all').getElementsByTagName('div'), cur_div = null;
for(var i=0; i<all.length; i++){
all[i].style.background = "white";
all[i].onmouseover = function(){
if(cur_div){
cur_div.style.background = 'white';
cur_div.style.color = '';
}
this.style.background = 'blue';
this.style.color = 'white';
cur_div = this;
}
}
} window.onload = change_tab;
</script>其实用class控制会省些事,优其要改变的样式比较多的情况下
class版
[code=HTML]<style>
#all div{background:white; color:black; text-align:center; cursor:default}
#all div.on{background:blue; color:white; font-weight:bold}
</style>
<div id="all" style=" border:1px solid #000000"> 
<div style="display:inline; width:50px">123 </div> 
<div style="display:inline; width:50px">456 </div> 
<div style="display:inline; width:50px">789 </div> 
</div>
<script>
function change_tab2(){
var all = document.getElementById('all').getElementsByTagName('div'), cur_div = null;
for(var i=0; i<all.length; i++){
all[i].onmouseover = function(){
if(cur_div == this) return;
cur_div ? cur_div.className = '' : '';
this.className = 'on'
cur_div = this;
}
}
} window.onload = change_tab2;
</script>