<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <style type="text/css"> *{margin:0;padding:0;} body{margin:50px;font-size:12px;color:#666;} li{list-style:none;} div{width:210px;} #tab1 ,#tab2{width:398px;height:34px;border:1px #cfedff solid;border-bottom:0;url(p_w_picpaths /title.gif) repeat-x;} #tab1 ul ,#tab2 ul{margin:0;padding:0;} #tab1 li,#tab2 li{float:left;padding:0 30px;height:34px;line-height:34px;text-align:center;border-right:1px #ebf7ff solid;cursor:pointer;} #tab1 li.now,#tab2 li.now{color:#5299c4;background:#fff;font-weight:bold;} .tablist{width:378px;height:100px;padding:10px;font-size:14px;line-height:24px;border:1px #cfedff solid;border-top:0;display:none;} .block{display:block; } </style> <script type="text/javascript"> function setTab(m,n){ var menu=document.getElementById("tab"+m).getElementsByTagName("li"); var div=document.getElementById("tablist"+m).getElementsByTagName("div"); var showdiv=[]; for (i=0; j=div[i]; i++){ if ((" "+div[i].className+" ").indexOf(" tablist ")!=-1){ showdiv.push(div[i]); } } for(i=0;i<menu.length;i++) { menu[i].className=i==n?"now":""; showdiv[i].style.display=i==n?"block":"none"; } } </script> <title>CSS中的滑动门效果_365CSS.CN</title> </head> <body> <div id="tab1"> <ul> <li class="now">第一行</li> <li οnmοuseοver="setTab(1,1)">第二行</li> <li οnmοuseοver="setTab(1,2)">第三行</li> <li οnmοuseοver="setTab(1,3)">第四行</li> </ul> </div> <div id="tablist1"> <div class="tablist block"> <span><div>第一行</div></span> </div> <div class="tablist"> <span>第二行 </span> </div> <div class="tablist"> <span>第三行 </span> </div> <div class="tablist"> <span>第四行</span> </div> </div> <br /><br /><br /> <div id="tab2"> <ul> <li class="now">第一行</li> <li οnclick="setTab(2,1)">第二行</li> <li οnclick="setTab(2,2)">第三行</li> </ul> </div> <div id="tablist2"> <div class="tablist block"> 第一行信息 </div> <div class="tablist"> <span>第二行</span> </div> <div class="tablist"> <span>第三行</span> </div> </div> </body> </html>