jQuery 导航
一个页面中有两个列表<!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 type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script><title>无标题文档</title><style type="text/css">.navi_pannel ul{list-style: none;width: 500px;margin: 0px auto;padding-left: 5px;height: 20px;}.navi_pannel li{float: left;width: 85px;height: 20px;line-height: 20px;margin-right: 6px;}.navi_pannel li a{position: relative;width: 100%;display: block;background: green;text-decoration: none;text-align: center;color: #fff;}.light1{background-color:#000!important;}</style></head><body> <form id="form1" runat="server"> <div> <div class="navi_pannel"> <ul> <li><a class="item" href="#" target="_self">111111</a></li> <li><a class="item" href="#" target="_self">222222</a></li> <li><a class="item" href="#" target="_self">333333</a></li> <li><a class="item" href="#" target="_self">444444</a></li> <li><a class="item" href="#" target="_self">555555</a></li> </ul> </div> </div></form><script type="text/javascript">jQuery(function($){ $('.item').hover(function(){ $(this).addClass('light1'); },function(){ $(this).removeClass('light1'); }).eq(0).addClass('light1'); });</script></body></html>