複製代碼代碼如下:
<! doctype html公共” - // W3C // DTD XHTML 1.0 Transitional // en>
<頭>
<meta http-equiv =“ content-type” content =“ text /html; charset = gb2312” />
<title>點擊切換和自動切換選項卡</title>
<style type =“ text/css”>
*{列表風格:無; margin:0;填充:0;溢出:隱藏}
。
。
li {float:左;寬度:99px; text-align:中心; line-height:28px;高度:28px; cursor:cursor:pointer; border-left:#a8c29f solid 1px; color:#666; font; font-size; font-size:14px; 14px; yesidfl:hidden}}}}}}}}
.menudiv {width:399px;高度:300px; border-left:#a8c29f實心1px; border-right:#a8c29f solid 1px; border-top:0; brounder-top:0; background:#fefefe}
。
.off {背景:#e0e2eb;顏色:#336699; font-權衡:bold}
</style>
<腳本類型=“ text/javascript”>
函數settab(name,cursel){
cursel_0 = cursel;
for(var i = 1; i <= links_len; i ++){
var Menu = document.getElementById(name+i);
var menudiv = document.getElementById(“ con _”+名稱+“ _”+i);
如果(i == cursel){
菜單。 className=“ off”;
menudiv.Style.display =“ block”;
}
別的{
菜單。 className=“”;
menudiv.style.display =“ none”;
}
}
}
函數next(){
cursel_0 ++;
如果(cursel_0> links_len)cursel_0 = 1
settab(name_0,cursel_0);
}
var name_0 ='一個';
var cursel_0 = 1;
var links_len,iintervalid;
onload =功能(){
var links = document.getElementById(“ tab1”)。 getElementsbytagname('li')
links_len = links.length;
for(var i = 0; i <links_len; i ++){
鏈接[i] .onmouseover = function(){
clear Interval(iintervalid);
}
}
document.getElementById(“ con _”+name_0+“ _”+links_len).parentnode.onmouseover = function(){
clear Interval(iintervalid);
}
settab(name_0,cursel_0);
}
</script>
</head>
<身體>
<H3> </h3>
<div ID =“ TAB1”>
<div>
<ul>
<li id =“ One1” OnClick =“ Settab('One',1)”>標籤1</li>
<li id =“ One2” OnClick =“ Settab('One',2)”>標籤2</li>
<li id =“ One3” OnClick =“ settab('One',3)”>標籤3</li>
<li id =“ One4” OnClick =“ Settab('One',4)”>標籤4</li>
</ul>
</div>
<div>
<div id =“ con_one_1”> <h4 style =“顏色:紅色”>標籤1-內容</h4> </div>
<div id =“ con_one_2” style =“ display:none;”> <h4 style =“顏色:紅色”>標籤2-內容</h4> </div> </div>
<div id =“ con_one_3” style =“ display:none;”> <h4 style =“顏色:紅色”>標籤3-內容</h4> </div> </div>
<div id =“ con_one_4” style =“ display:none;”> <h4 style =“顏色:red”>標籤4-內容</h4> </div> </div>
</div>
</div>
</body>