[JavaScript] 下拉菜单 →→→→→进入此内容的聊天室

来自 , 2020-09-17, 写在 JavaScript, 查看 173 次.
URL http://www.code666.cn/view/d9fc5b73
  1. javascript 原生代码
  2. <ul class="nav">
  3. <li><a href="/">&nbsp;首页&nbsp;</a></li>
  4. <li id="li_1" onmouseover="show(1)" onmouseout="hide(1)"><a href="http://www.wufangbo.com/category/css/">css</a>
  5.         <dl id="dl_1">
  6.         <dd><a href="#">老凡CSS</dd>
  7.         <dd><a href="#">中凡CSS</dd>
  8.         <dd><a href="#">小凡CSS</dd>
  9.     </dl>
  10. </li>
  11. <li id="li_2" onmouseover="show(2)" onmouseout="hide(2)"><a href="http://www.wufangbo.com/category/css3-html5/">css3</a>
  12.         <dl id="dl_2">
  13.         <dd><a href="#">老凡CSS</dd>
  14.         <dd><a href="#">中凡CSS</dd>
  15.         <dd><a href="#">小凡CSS</dd>
  16.     </dl>
  17. </li>
  18. <li><a href="http://www.wufangbo.com/category/javascript/">javascript</a> </li>
  19. <li><a href="http://www.wufangbo.com/category/jquery/">jquery</a> </li>
  20. <li id="li_3" onmouseover="show(3)" onmouseout="hide(3)"><a href="http://www.wufangbo.com/category/yhty/">ued</a>
  21.         <dl id="dl_3">
  22.         <dd><a href="#">老凡CSS</dd>
  23.         <dd><a href="#">中凡CSS</dd>
  24.         <dd><a href="#">小凡CSS</dd>
  25.     </dl>
  26. </li>
  27. <li><a href="http://www.wufangbo.com/category/linux/">linux</a> </li>
  28. <li><a href="http://www.wufangbo.com/category/wordpress/">wordpress</a> </li>
  29.  
  30. </ul>
  31. function show(i)
  32.         {
  33.                 document.getElementById('dl_'+i).style.display='block';
  34.                
  35.         }
  36.         function hide(i)
  37.         {
  38.                 document.getElementById('dl_'+i).style.display='none';
  39.         }
  40. jquery的原生代码
  41. $("document").ready(function(){
  42.                 $(".nav li").hover(function(){
  43.                                                 $(this).find('dl').show();                     
  44.                                                                 },function(){
  45.                                      $(this).find('dl').hide();
  46.                                                      })
  47.               $(".nav li").mouseover(function(){
  48.                                                          $(this).find('dl').fadeIn('slow');                      
  49.                                                                                   })
  50.                  
  51.                   $(".nav li").mouseout(function(){
  52.                                                          $(this).find('dl').hide();                      
  53.                                                                                   })                                                             
  54.            })

回复 "下拉菜单"

这儿你可以回复上面这条便签

captcha