===已编辑===
jsfiddle:http: //jsfiddle.net/sw9YV/10/
试试这个html:
<div id="group1">
<div class="first hoverMe">1</div>
<div class="second hoverMe">2</div>
<div class="third hoverMe">3</div>
<div class="fourth hoverMe">4</div>
</div>
<br /><br /><br />
<div id="group2">
<div class="first hoverMe">1</div>
<div class="second hoverMe">2</div>
<div class="third hoverMe">3</div>
<div class="fourth hoverMe">4</div>
</div>
这个js:
$(".hoverMe").mouseover(function(){
$(this).css("background-color","#d3d3d3");
$(this).prevAll(".hoverMe").css("background-color","#d3d3d3");
});
$(".hoverMe").mouseout(function(){
$(this).css("background-color","");
$(this).prevAll(".hoverMe").css("background-color","");
});