大概需要实现的是这样的,在鼠标经过列表时,让列表中的改行背景色变色,和能够得到该行列表的值,离开鼠标背景色回到白色。  麻烦大家指点一下啊。我的li列表大致是这样的(实际中我的li列表的个数是根据数据表的记录循环来的),<div id="libox">
 <ul style="list-style:none; line-height:16px; float:left; padding:0px; margin:0px;width:100%" id="brandLiId">
   <li>笔记本</li>
<li>手机</li>
<li>鞋子</li>
<li>运动</li>
</ul>
</div>

解决方案 »

  1.   


      jQuery(function($) {
            $("li").hover(
              function () {
                $(this).css("background", "red");
                alert($(this).html());
              },
              function () {
                $(this).css("background", "white");
              }
            ); 
        }); 
      

  2.   

    <!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=gb2312">
    <title> new document </title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <script type="text/javascript" src="js/jq.js"></script>
    </head>
    <body>
    <div id="libox">
     <ul style="list-style:none; line-height:16px; float:left; padding:0px; margin:0px;width:100%" id="brandLiId">
    <li>笔记本</li>
    <li>手机</li>
    <li>鞋子</li>
    <li>运动</li>
    </ul>
    </div>
    <script type="text/javascript">
    <!--
    $("#brandLiId li").hover(function(){$(this).css("background-color","red")},function(){$(this).css("background-color","white")})
    //-->
    </script>
    </body>
    </html>