

$(".a").mouseover(function(){$(".b",this).css(...)})我用来不管用啊。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready( function() {
 $("div.a span.b").mouseover( function() { $(this).css("background-color", "red"); });
});
</script>
</head>
 
<body>
<div class="a"><span class="b">111</span></div>
<div class="a"><span class="b">222</span></div>
</body>
</html><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <title></title>
 <script src="http://code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>
 <script type="text/javascript">
 $(document).ready(function () {
 $(".a").mouseover(function () {
 $(this).find('.b').css({color:'red'}); 
 });
 });
 </script>
 
</head>
<body>
<body>
<div class="a" style="border:1px solid red;">
<span class="b">111</span>
<span class="b">222</span>
</div>
<div class="a" style="border:1px solid green;">
<span class="b">333</span>
<span class="b">444</span>
</div>
</body>
 
</body>
</html>哈哈,日,乌龙了。
你们没有测试一下我的写法吗?也对的,但是我把那个span写在div外边了。
那个写法确实不常见,在stackoverflow上看来的。
