標籤:內容 rip type gpo get post order lang pad
1 <!doctype html> 2 <html lang="en"> 3 <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> 4 <head> 5 <meta charset="UTF-8"> 6 <title>boss愛國</title> 7 <style> 8 body{background:#ececec;margin:0;} 9 #test{width:100%;height:40px;background:#fff;}10 .btn{padding:11px 16%;float:left;list-style:none;}11 .focus{border-bottom:1px solid #269be8; color:#269be8;}12 .line{width: 1px;text-indent: -10000px;border-right: 1px solid #ccc;height: 28px;float:left;margin-top:3px;}13 .content{padding:4%;display:none;}14 </style>15 </head>16 <body>17 <div id=‘test‘>18 <li id=‘btn_1‘ onclick=‘switchTab(1)‘ style=‘padding:11px 16%;float:left;list-style:none;‘ class=‘focus‘>毛**語錄</li> 19 <li class=‘line‘>|</li>20 <li id=‘btn_2‘ class=‘btn‘ onclick=‘switchTab(2)‘ style=‘padding:11px 16%;float:left;list-style:none;‘>共**宣言</li>21 </div>22 <div id=‘con_1‘ class=‘content‘ style=‘display:block‘>23 《毛**語錄》,是二十世紀六十年代初編輯出版、風靡全國乃至世界的毛**主席名言警句選編本,發行量達50億冊,位居世界第二。因為最流行的版本用紅色封麵包裝,又是紅色領袖的經典言論,所以文化大革命中被普遍稱為“紅寶書”。24 </div>25 <div id=‘con_2‘ class=‘content‘>26 《共**宣言》,是卡爾·馬克思和費裡德裡希·恩格斯為共產主義者同盟(Communist League)起草的綱領,國際共產主義運動第一個綱領性文獻,闡述了階級矛盾對人類曆史的影響,...27 </div>28 </body>29 <script type="text/javascript">30 function switchTab(n){31 for(var i = 1; i <= 2; i++){32 document.getElementById("btn_" + i).className = ""; //先把所有的按鈕的class設為0,33 document.getElementById("con_" + i).style.display = "none"; //把所有的內容隱藏34 }35 document.getElementById("btn_" + n).className = "focus"; //為點擊的按鈕加上樣式36 document.getElementById("con_" + n).style.display = "block"; //顯示點擊的內容37 }38 </script>39 </html>
javascript標籤頁切換功能(極簡代碼)