您的位置:首页 > Web前端 > JavaScript

js 多层叠的TAB选项卡

2010-01-25 00:00 609 查看
HTML:多个导航tag加一个放置默认内容div
脚本:以数组的形式给出每个导航对应的html





多层叠TAB选项卡

.nonstop { width:168px; font-size:12px;margin:auto; border:1px solid #cdcdcd; padding:2px; overflow:hidden; }
.nonstop span { float:left;_display:inline; cursor:pointer; width:22px; height:14px; background:#cdcdcd url(./img/button.gif) no-repeat -175px top; font-size:10px; line-height:14px; margin:2px 0 0 2px; display:inline; text-align:center; }
.nonstop span:hover { background:gray; font-weight:bold }
.nonstop div { height:300px; clear:both; border:1px solid #cdcdcd; border-width:2px 1px; margin-left:2px; overflow:hidden; }
.nonstop div a { float:left; width:80px; height:40px; background:white; text-align:center; line-height:40px; padding-top:8px; margin:1px 0 0 1px; }
.nonstop div a img { border:0; }
.nonstop span.hot { border:1px solid red; width:20px; color:white; height:15px; background:red url(./img/button.gif) no-repeat -175px -14px; font-weight:bold; border-bottom:none; }



一个多层叠的TAB选项卡,自适应宽度(自行更改nonstop的width测试效果)。
HTML:多个导航tag加一个放置默认内容div
脚本:以数组的形式给出每个导航对应的html

ABCDEFG
HI JMLNO
PSTUYZ!

这里放一些默认内容
11111111



//20个字母下的品牌,不包含默认显示的内容
var contHtml = ['a1','b2','c3','d4','e5','f6','g7','h21','i22','j23','m24','l25','n26','o27','p11','s12','t13','u14','y15','z16'];
var a2zBox = document.getElementById("a2zbox");
var a2zTag = a2zBox.getElementsByTagName("span");
var a2zCont = a2zBox.getElementsByTagName("div")[0];
var divs = [],colN=Math.floor(a2zCont.clientWidth/(a2zTag[0].clientWidth))//7;
for(var n=1; n
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: