• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

关于javascript+css(asp.net)实现tab功能

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

 

<html>
<head  runat="Server">
<style type="text/css" language="javascript">
.tabheader table {
  border-collapse: collapse; /* for IE */
  border-spacing: 0; /* for N6 */
}
.tabheader table tr td {margin:0;padding:0;border-width:0}

.tabheader .close {
  border-style: solid;
  border-width: 1px;
  border-color: #000;
  background-color: #d0d0d0;
  margin:0;
  padding: 0.5em;
  white-space: nowrap;
}
.tabheader .open {
  border-style: solid;
  border-width: 1px;
  border-color: #000 #000 #fff #000;
  background-color: white;
  margin:0;
  padding: 0.5em;
  white-space: nowrap;
}
.tabheader .spc {
  border-style: solid;
  border-width: 1px 0 1px 0;
  border-color: #fff #fff #000 #fff;
  margin:0;
  padding: 0.5em;
  white-space: nowrap;
}

.tabheader a {text-decoration: none;}
.tabbody {
  border-color: black;
  border-style: solid;
  border-width: 0 1px 1px 1px;
  padding: 1em;
}

</style>
<script language="JavaScript">
<!--
 
function seltab(bpref, hpref, id_max, selected) {
  if (! document.getElementById) return;
  for (i = 0; i <= id_max; i++) {
    if (! document.getElementById(bpref + i)) continue;
    if (i == selected) {
      document.getElementById(bpref + i).style.visibility = "visible";
      document.getElementById(bpref + i).style.position = "";
      document.getElementById(hpref + i).className = "open";
    } else {
      document.getElementById(bpref + i).style.visibility = "hidden";
      document.getElementById(bpref + i).style.position = "absolute";
      document.getElementById(hpref + i).className = "close";
    }
  }
}
// -->
</script>
<title>Tab功能</title>
</head>
    <body bgcolor="white" onload="seltab('box', 'head', 10, 1)">
        <h1></h1>
        <div class="tabheader">
            <table>
                <tr>
                    <td>
                        <div >
                            <a href="javascript:seltab('box', 'head', 10, 1)">tab1</a>
                        </div>
                    </td>
                    <td><div class="spc"> </div>
                    </td>
                    <td>
                        <div >
                            <a href="javascript:seltab('box', 'head', 10, 2)">tab2</a>
                        </div>
                    </td>
                    <td><div class="spc"> </div>
                    </td>
                    <td>
                        <div >
                            <a href="javascript:seltab('box', 'head', 10, 3)">tab3</a>
                        </div>
                    </td>
                    <td><div class="spc"> </div>
                    </td>
                    <td>
                        <div >
                            <a href="javascript:seltab('box', 'head', 10, 4)">tab4</a>
                        </div>
                    </td>
                    <td width="100%"><div class="spc"> </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="tabbody">
            <div >
                <p>
                    test
                </p>
            </div>
            <div >
                <p>test
                </p>
                <p>test
                </p>
            </div>
            <div >
                <p>testtesttest
                </p>
            </div>
            <div >
                <p>
                    testtest
                </p>
            </div>
       </div>
    </body>
</html>


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ASP.NETMVC5身份系统Identity发布时间:2022-07-10
下一篇:
ASP.NET获取IP的6种方法发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap