jquery实现点击块时高亮显示

当在dd标签上单击时,将当前dd块进行高亮显示

<!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="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<style>
  .banner { background: #0094ff; }
  .bannerOver { background: #808080; }
  .cur { background: #ff6a00; }
</style>
<script>
  $(function () {
    $(
'#menu_title').find('dd').click(function () {       $('#menu_title').find('dd').removeClass('cur');       $(this).addClass('cur');     });   }); </script> </head> <body> <dl id="menu_title"> <dt></dt> <dd>一种高级动物</dd> <dt></dt> <dd>人类的朋友</dd> <dt></dt> <dd>猫科动物的祖先</dd> </dl> </body> </html>

 

posted on 2013-02-20 15:13  风林幻海  阅读(339)  评论(0编辑  收藏  举报

导航