zoukankan      html  css  js  c++  java
  • tab页卡效果!

    最进遇到了问题,一个界面要展示很多内容,所以需要页卡分开显示,但是集成其它的拖动控件,导致jquery等tab控件失效,或者导入jquery后原本的脚本报错。 所以找了个手写的分享下:

    先来张效果图:

    下面是HTML代码:

    <html xmlns="http://www.w3.org/1999/xhtml"> 

    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
    <title>简洁Tab</title>
    <style type="text/css">
    <!--
    body,div,ul,li{
    padding:0;
    text-align:center;
    }
    body{
    font:12px "宋体";
    text-align:center;
    }

    ul{ list-style:none;}
    /*选项卡1*/
    #Tab1{
    100%;
    margin:0px;
    padding:0px;
    margin:0 auto;}
    /*选项卡2*/
    #Tab2{
    576px;
    margin:0px;
    padding:0px;
    margin:0 auto;}
    /*菜单class*/
    .Menubox {
    100%;
    background:url(http://www.jb51.net/upload/small/20079299441652.gif);
    height:28px;
    line-height:28px;
    }
    .Menubox ul{
    margin:0px;
    padding:0px;
    }
    .Menubox li{
    float:left;
    display:block;
    cursor:pointer;
    114px;
    text-align:center;
    color:#949694;
    font-weight:bold;
    }
    .Menubox li.hover{
    padding:0px;
    background:#fff;
    116px;
    border-left:1px solid #A8C29F;
    border-top:1px solid #A8C29F;
    border-right:1px solid #A8C29F;
    background:url(http://www.jb51.net/upload/small/200792994426548.gif);
    color:#739242;
    font-weight:bold;
    height:27px;
    line-height:27px;
    }
    .Contentbox{
    clear:both;
    margin-top:0px;
    border:1px solid #A8C29F;
    border-top:none;
    height:181px;
    text-align:center;
    padding-top:8px;
    }
    -->
    </style>
    <script>
    <!--
    /*第一种形式 第二种形式 更换显示样式*/
    function setTab(name,cursel,n){
    for(i=1;i<=n;i++){
    var menu=document.getElementById(name+i);
    var con=document.getElementById("con_"+name+"_"+i);
    menu.className=i==cursel?"hover":"";
    con.style.display=i==cursel?"block":"none";
    }
    }
    //-->
    </script>
    </head>
    <body>



    <div id="Tab1">
    <div class="Menubox">
    <ul>
    <li id="one1" onClick="setTab('one',1,2)" class="hover">新闻1</li>
    <li id="one2" onClick="setTab('one',2,2)" >新闻2</li>
    </ul>
    </div>
    <div class="Contentbox">
    <div id="con_one_1" class="hover">新闻列表1</div>
    <div id="con_one_2" style="display:none">新闻列表2</div>
    </div>
    </div>

    </body>

  • 相关阅读:
    fastjson生成和解析json数据
    fastJson API
    js实现class样式的修改、添加及删除的方法
    jquery ajax局部加载方法介绍
    jquery 动态添加和删除 ul li列表
    spring mvc3中的addFlashAttribute方法
    Spring MVC 3 : 一次上传多个文件
    pring mvc 批量上传+文件上传
    SpringMVC批量上传
    Android ADT Bundle(Eclipse with ADT) ADT R23
  • 原文地址:https://www.cnblogs.com/cttinchina/p/4097814.html
Copyright © 2011-2022 走看看