1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html;charset=gb2312" /> 
  5. <title>简洁Tab</title> 
  6. <style type="text/css"> 
  7. <!-- 
  8. body, div, ul, li {padding:0;text-align:center;} 
  9. body {font:12px "宋体";text-align:center;} 
  10. a:link {color:#00F;text-decoration:none;} 
  11. a:visited {color: #00F;text-decoration:none;} 
  12. a:hover {color: #c00;text-decoration:underline;} 
  13. ul {list-style:none;} 
  14. /*选项卡1*/ 
  15. #Tab1 {width:900px;margin:0px;padding:0px;margin:0 auto;} 
  16. /*菜单class*/ 
  17. .Menubox {width:100%;background:url();height:28px;line-height:28px;} 
  18. .Menubox ul {margin:0px;padding:0px;} 
  19. .Menubox li {float:left;display:block;cursor:pointer;width:114px;text-align:center;color:#949694;font-weight:bold;} 
  20. .Menubox li.hover {padding:0px;background:#fff;width:116px;border-left:1px solid #A8C29F;border-top:1px solid #A8C29F;border-right:1px solid #A8C29F;background:url 
  21. ();color:#739242;font-weight:bold;height:27px;line-height:27px;} 
  22. .Contentbox {clear:both;margin-top:0px;border:1px solid #A8C29F;border-top:none;height:181px;text-align:center;padding-top:8px;} 
  23. --> 
  24. </style> 
  25. </head> 
  26. <body> 
  27. <br> 
  28. <br> 
  29. <div id="Tab1"> 
  30.     <div class="Menubox"> 
  31.         <ul> 
  32.             <li id="one0" onmouseover="setTab('one',0,7)"  class="hover">新闻1</li> 
  33.             <li id="one1" onmouseover="setTab('one',1,7)" >新闻2</li> 
  34.             <li id="one2" onmouseover="setTab('one',2,7)">新闻3</li> 
  35.             <li id="one3" onmouseover="setTab('one',3,7)">新闻4</li> 
  36.             <li id="one4" onmouseover="setTab('one',4,7)">新闻5</li> 
  37.             <li id="one5" onmouseover="setTab('one',5,7)">新闻6</li> 
  38.             <li id="one6" onmouseover="setTab('one',6,7)">新闻7</li> 
  39.         </ul> 
  40.     </div> 
  41. </div> 
  42. <br> 
  43. <script> 
  44. <!-- 
  45. /*第一种形式 第二种形式 更换显示样式*/ 
  46. var index; 
  47. function setTab(name,cursel,n){ 
  48.     for(var i=0;i<n;i++){ 
  49.         var menu=document.getElementById(name+i); 
  50.         menu.className=i==cursel?"hover":""; 
  51.                               if (menu.className=="hover") 
  52.                                   iindex=i; 
  53.     } 
  54. }     
  55. var num=0
  56. var AutoPlayObj=null
  57. function d() 
  58.     { 
  59.         setTab('one',num%7,7);     
  60.         num++; 
  61.     } 
  62. function AutoPlay() 
  63.     { 
  64.         clearInterval(AutoPlayObj); 
  65.         AutoPlayObj=setInterval('d()',500) 
  66.     }; 
  67. AutoPlay(); 
  68. var tab1 = document.getElementById("Tab1"); 
  69. tab1.onmouseover = function (){ 
  70. num=index
  71. clearInterval(AutoPlayObj); 
  72. tab1.onmouseout = function(){AutoPlay();} 
  73. //--> 
  74. </script> 
  75. </body> 
  76. </html> 
  77.