标签:
1 <!-- 2 引用时保留下原创作者喽,尊重任何一位原创作者,促进中国互联网进程 3 Editor:weasle 4 Email:weasle@163.com 5 QQ:112011531 6 --> 7 <html xmlns="http://www.w3.org/1999/xhtml"> 8 <head> 9 <meta http-equiv="Content-Type" content="text/html;charset=gb2312" /> 10 <title>简洁Tab</title> 11 <style type="text/css"> 12 <!-- 13 body,div,ul,li{ 14 padding:0; 15 text-align:center; 16 } 17 body{ 18 font:12px "宋体"; 19 text-align:center; 20 } 21 a:link{ 22 color:#00F; 23 text-decoration:none; 24 } 25 a:visited { 26 color: #00F; 27 text-decoration:none; 28 } 29 a:hover { 30 color: #c00; 31 text-decoration:underline; 32 } 33 ul{ list-style:none;} 34 /*选项卡1*/ 35 #Tab1{ 36 width:460px; 37 margin:0px; 38 padding:0px; 39 margin:0 auto;} 40 /*选项卡2*/ 41 #Tab2{ 42 width:576px; 43 margin:0px; 44 padding:0px; 45 margin:0 auto;} 46 /*菜单class*/ 47 .Menubox { 48 width:100%; 49 background:url(http://www.jb51.net/upload/small/20079299441652.gif); 50 height:28px; 51 line-height:28px; 52 } 53 .Menubox ul{ 54 margin:0px; 55 padding:0px; 56 } 57 .Menubox li{ 58 float:left; 59 display:block; 60 cursor:pointer; 61 width:114px; 62 text-align:center; 63 color:#949694; 64 font-weight:bold; 65 } 66 .Menubox li.hover{ 67 padding:0px; 68 background:#fff; 69 width:116px; 70 border-left:1px solid #A8C29F; 71 border-top:1px solid #A8C29F; 72 border-right:1px solid #A8C29F; 73 background:url(http://www.jb51.net/upload/small/200792994426548.gif); 74 color:#739242; 75 font-weight:bold; 76 height:27px; 77 line-height:27px; 78 } 79 .Contentbox{ 80 clear:both; 81 margin-top:0px; 82 border:1px solid #A8C29F; 83 border-top:none; 84 height:181px; 85 text-align:center; 86 padding-top:8px; 87 } 88 --> 89 </style> 90 <script> 91 <!-- 92 /*第一种形式 第二种形式 更换显示样式*/ 93 function setTab(name,cursel,n){ 94 for(i=1;i<=n;i++){ 95 var menu=document.getElementById(name+i); 96 var con=document.getElementById("con_"+name+"_"+i); 97 menu.className=i==cursel?"hover":""; 98 con.style.display=i==cursel?"block":"none"; 99 } 100 } 101 //--> 102 </script> 103 </head> 104 <body> 105 106 107 108 <div id="Tab1"> 109 <div class="Menubox"> 110 <ul> 111 <li id="one1" onclick="setTab(‘one‘,1,4)" class="hover">新闻1</li> 112 <li id="one2" onclick="setTab(‘one‘,2,4)" >新闻2</li> 113 <li id="one3" onclick="setTab(‘one‘,3,4)">新闻3</li> 114 <li id="one4" onclick="setTab(‘one‘,4,4)">新闻4</li> 115 </ul> 116 </div> 117 <div class="Contentbox"> 118 <div id="con_one_1" class="hover">新闻列表1</div> 119 <div id="con_one_2" style="display:none">新闻列表2</div> 120 <div id="con_one_3" style="display:none">新闻列表3</div> 121 <div id="con_one_4" style="display:none">新闻列表4</div> 122 </div> 123 </div> 124 125 126 <div id="Tab2"> 127 <div class="Menubox"> 128 <ul> 129 <li id="two1" onclick="setTab(‘two‘,1,4)" class="hover">新闻1</li> 130 <li id="two2" onclick="setTab(‘two‘,2,4)" >新闻2</li> 131 <li id="two3" onclick="setTab(‘two‘,3,4)">新闻3</li> 132 <li id="two4" onclick="setTab(‘two‘,4,4)">新闻4</li> 133 </ul> 134 </div> 135 <div class="Contentbox"> 136 <div id="con_two_1" >新闻列表1</div> 137 <div id="con_two_2" style="display:none">新闻列表2</div> 138 <div id="con_two_3" style="display:none">新闻列表3</div> 139 <div id="con_two_4" style="display:none">新闻列表4</div> 140 </div> 141 </div> 142 </body>
标签:
原文地址:http://www.cnblogs.com/chenls/p/5480706.html