<!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" />
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<style type="text/css">
li {
list-style-type:none;
width:50px;
float:left;
}
</style>
<title>无标题文档</title>
</head>
<body>
<li>英语</li>
<li>数学</li>
<li>物理</li>
<script>
$("li").each(function(){ 
   $(this).mouseover(function(){
$(this).css("color","red")
})    $(this).mouseout()(function(){
$(this).css("color","green")
}); 
}); 
</script>
</body>
</html>

解决方案 »

  1.   

    <li>英语</li>
    <li>数学</li>
    <li>物理</li>
    <script type="text/javascript">
    $("li").mouseover( function() { $(this).css('color', 'red'); }).mouseout( function() { $(this).css('color', 'green'); });
    </script>
      

  2.   

    <!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" />
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <style type="text/css">
    li {
    list-style-type:none;
    width:50px;
    float:left;
    }
    </style>
    <title>无标题文档</title>
    </head>
    <body>
    <li>英语</li>
    <li>数学</li>
    <li>物理</li>
    <script>
    $("li").each(function(){  
      $(this).mouseover(function(){
    $(this).css("color","red")
    }) 
      $(this).mouseout(function(){
    $(this).css("color","green")
    });  
    });  
    </script>
    </body>
    </html>