我现在要做一个登陆页面,分别有子账户和主账户。要分开登陆所以要用上选项卡。谁有代码,发给我看看

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style>
    *{margin:0; padding:0;}
    body{font-size:12px;}
    ul{list-style:none;}
    ul li{float:left; width:100px; height:100px; background:#000; cursor:pointer; margin-right:10px; display:inline; color:#fff;}
    </style>
    </head><body>
        <ul>
         <li>主帐号</li>
            <li>子帐号</li>
        </ul>
    <div style="display:none; width:100px; height:100px; border:1px solid #000; float:left;">主</div>
        <div style="display:none; width:100px; height:100px; border:1px solid #000; float:left">子</div>
        <script>
    var lis = document.getElementsByTagName('li'),
    len = lis.length,
    divs = document.getElementsByTagName('div');

    for(var i = 0; i < len; i++){
    !function(i){
    lis[i].onclick = function(){
    for(var j = 0; j < len; j++){
    divs[j].style.display = 'none';
    }

    divs[i].style.display = 'block';
    };
    }(i)
    }
    </script>
    </body>
    </html>
      

  2.   

    http://jqueryui.com/demos/tabs/
     这个?