ajax控件tabs是现成的,其他tab源码也很多.google下啦

解决方案 »

  1.   

    onmouseover事件可以实现...
      

  2.   

    就是显示一个DIV,隐藏其它的DIV function showtab( m, n )
    {
    for( var i = 1; (document.getElementById('td_' + m + '_' + i) != null); i++ )
    {
    if ( i == n )
    {
    document.getElementById("td_"+m+"_"+i).className="tabs1 tab1_actived";
    document.getElementById("list_"+m+"_"+i).className="style5 show";
    }
    else
    {
    document.getElementById("td_"+m+"_"+i).className="tabs1";
    document.getElementById("list_"+m+"_"+i).className="style5 hidden";
    }
    }
    } function showdiv( num, id, m )
    {
    for( i = 0; document.getElementById('title_' + m + '_' + i) != null; i++ )
    {
    var obj = document.getElementById('title_' + m + '_' + i);

    if( i == num )
    {
    obj.className = "style6 style61";
    window.frames['products'].location = "frmproduct.aspx?categoryid=" + id + "&categoryname=" + escape(obj.innerText) + "&categorynum=" + m;
    }
    else
    {
    obj.className = "style6";
    }
    }
    }
      

  3.   

    div+css
    <script language="JavaScript" type="text/javascript">function ChangeDiv(divId,divName,zDivCount) 

    for(i=0;i<=zDivCount;i++) 

    document.getElementById(divName+i).style.display="none"; 

    document.getElementById(divName+divId).style.display="block"; 
    }</script>
    <span onMouseMove="JavaScript:ChangeDiv('0','JKDiv_',2)" style="cursor:hand;">内容一</span> 
    <span onMouseMove="JavaScript:ChangeDiv('1','JKDiv_',2)" style="cursor:hand;">内容二</span> 
    <span onMouseMove="JavaScript:ChangeDiv('2','JKDiv_',2)" style="cursor:hand;">内容三</span>
    <div id="BigDIV" style="border:solid 1px #cccccc;width:460px;margin:10px;"> 
    <div id="JKDiv_0" style="font-size:14px;margin:20px;color:#FF0000;">内容部分第一区<br> <img src="http://www.80boby.com/images/common/water.gif"></div> 
    <div id="JKDiv_1" style="display:none;font-size:14px;margin:10px;color:#FF0000;">内容部分第二区<br><img src="http://www.80boby.com/logo.gif"></div> 
    <div id="JKDiv_2" style="display:none;font-size:14px;margin:10px;color:#FF0000;">内容部分第三区</div> 
    </div>
      

  4.   

    onmouseover 事件中用 js 来控制层的显示和隐藏