复制代码 代码如下: 点击切换和自动切换选项卡 <br> *{list-style:none;margin:0; padding:0;overflow:hidden} <br> .tab1{width:401px;border-top:#A8C29F solid 1px;border-bottom:#A8C29F solid 1px;margin:50px 200px;} <br> .menu{width:400px;background:#eee;height:28px;border-right:#A8C29F solid 1px;border-bottom:#A8C29F solid 1px;} <br> li{float:left;width:99px;text-align:center;line-height:28px;height:28px;cursor:pointer;border-left:#A8C29F solid 1px;color:#666;font-size:14px; limpahan:tersembunyi} <br> .menudiv{width:399px;height:300px;border-left:#A8C29F solid 1px;border-right:#A8C29F solid 1px;border-top:0;background:#fefefe} <br> .menudiv div{padding:15px;line-height:28px;} <br> .off{background:#E0E2EB;color:#336699;font-weight:bold} <br> <br> fungsi setTab(nama,kursel){ <br> cursel_0=cursel; <br> untuk(var i=1; i<=links_len; i ){ <br /> var menu = document.getElementById(nama i); <br /> var menudiv = document.getElementById("con_" nama "_" i); <br /> if(i==kursel){ <br /> menu.className="off"; <br /> menudiv.style.display="block"; <br /> } <br /> lain{ <br /> menu.className=""; <br /> menudiv.style.display="none"; <br /> } <br /> } <br /> } <br /> fungsi Seterusnya(){ <br /> cursel_0 ; <br /> jika (cursel_0>links_len)cursel_0=1 <br> setTab(nama_0, cursel_0); <br> } <br> var name_0='satu'; <br> var cursel_0=1; <br> var links_len,iIntervalId; <br> onload=function(){ <br> pautan var = document.getElementById("tab1").getElementsByTagName('li') <br> links_len=links.length; <br> untuk(var i=0; i<links_len; i ){ <br /> pautan[i].onmouseover=function(){ <br /> clearInterval(iIntervalId); <br /> } <br /> } <br /> document.getElementById("con_" name_0 "_" links_len).parentNode.onmouseover=function(){ <br /> clearInterval(iIntervalId); <br /> } <br /> setTab(nama_0, cursel_0); <br /> } <br /> </skrip> <br> </head> <br> <badan> <br> <h3> </h3> <br> <div class="tab1" id="tab1"> <br> <div class="menu"> <br> <ul> <br> <li id="one1" onclick="setTab('one',1)">标签1</li> <br> <li id="one2" onclick="setTab('one',2)">标签2</li> <br> <li id="one3" onclick="setTab('one',3)">标签3</li> <br> <li id="one4" onclick="setTab('one',4)">标签4</li> <br> </ul> <br> </div> <br> <div class="menudiv"> <br> <div id="con_one_1"><h4 style="color:red">标签1-内容</h4></div> <br> <div id="con_one_2" style="display:none;"><h4 style="color:red">标签2-内容</h4></div> <br> <div id="con_one_3" style="display:none;"><h4 style="color:red">标签3-内容</h4></div> <br> <div id="con_one_4" style="display:none;"><h4 style="color:red">标签4-内容</h4></div> <br> </div> <br> </div> <br> </badan> <br> </div>