1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Scriptsrc= "Http://code.jquery.com/jquery-1.7.2.min.js"></Script>4 <Head>5 <MetaCharSet= "UTF-8">6 <title>Boss Patriotic</title>7 <style>8 Body{background:#ececec;margin:0;}9 #test{width:100%;Height:40px;background:#fff;}Ten . BTN{padding:11px 16%;float: Left;List-style:None;} One . Focus{Border-bottom:1px solid #269be8;Color:#269be8;} A . Line{width:1px;text-indent:-10000px;Border-right:1px solid #ccc;Height:28px;float: Left;Margin-top:3px;} - . Content{padding:4%;Display:None;} - </style> the </Head> - <Body> - <DivID= ' Test '> - <LiID= ' btn_1 'onclick= ' Switchtab (1) 'style= ' padding:11px16%;float:left;list-style:none; ' Class= ' Focus '>Mao * * Quotations</Li> + <Liclass= ' line '>|</Li> - <LiID= ' btn_2 'class= ' btn 'onclick= ' Switchtab (2) 'style= ' padding:11px16%;float:left;list-style:none; '>Total declaration</Li> + </Div> A <DivID= ' con_1 'class= ' content 'style= ' Display:block '> at "Mao * * * * * * * * * * *", is the the early 1960s edition publishing, swept the country and even the world Mao * * President's famous aphorism selected this, the circulation reached 5 billion volumes, ranked second in the world. Because the most popular version is wrapped in red cover and is the classic speech of the red leader, the Cultural Revolution was popularly referred to as "Red Book". - </Div> - <DivID= ' con_2 'class= ' content '> - the declaration of Communism is the programme drafted by Karl Marx and Ferridrich Engues for authored (Communist League), the first programmatic document of the international Communist movement, which expounds the effects of class contradictions on human history ... - </Div> - </Body> in <Scripttype= "Text/javascript"> - functionSwitchtab (n) { to for(varI= 1; I<= 2; I++){ + document.getElementById ("Btn_" +i). ClassName= ""; //set the class of all the buttons to 0 first, - document.getElementById ("Con_" +i). Style.display= "None"; //Hide all the content the } * document.getElementById ("Btn_" +N). ClassName= "Focus"; //add a style to the clicked button $ document.getElementById ("Con_" +N). Style.display= "Block"; //display the clicked contentPanax Notoginseng } - </Script> the </HTML>
JavaScript tab switch function (minimalist code)