当在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>