600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 将两个div左右并列显示并实现点击标题切换内容【javascript】

将两个div左右并列显示并实现点击标题切换内容【javascript】

时间:2019-02-06 12:21:00

相关推荐

将两个div左右并列显示并实现点击标题切换内容【javascript】

web前端|js教程

左右并列,点击标题,切换内容

web前端-js教程

php手机浏览器源码下载,vscode启动项目失败,ubuntu启动只有_,tomcat 运维检查,arcgis爬虫软件,php ajax批量删除,新手如何学习seo 留痕,装修公司网站源码 php,贷款网站模板下载lzw

选项卡

<!--

* { margin:0; padding:0; font-size:12px; font-weight:normal; }

.jj { font-weight:bolder!important; }

.box { border-top-color:#c00!important; }

.pr { color:#060!important; }

#tab01 { position:relative; width:336px; height:88px; padding-top:15px; margin:50px; overflow:hidden; }

#tab01 h3 { position:relative; z-index:2; float:left; height:14px; padding:0 7px 0 8px; margin-left:-1px; border-left:solid 1px #ccc; border-right:solid 1px #fff; text-align:center; background:#fff; cursor:pointer; }

#tab01 h3.up { height:18px; padding:5px 7px 0 7px; margin:-6px 0 0 0; border:solid #ccc; border-width:1px 1px 0; color:#c00; }

#tab01 div { display:none; position:absolute; left:0; top:32px; z-index:1; width:324px; height:54px; padding:5px; border:solid 1px #ccc; color:#666; }

#tab01 div.up { display:block; }

#tab02 { position:relative; width:200px; margin:50px; border:solid #ccc; border-width:0 1px 1px; }

#tab02 h4 { height:18px; line-height:18px; border:solid #ccc; border-width:1px 0; margin-bottom:-1px; text-align:center; background:#f6f6f6; cursor:pointer; }

#tab02 h4.up { color:#c00; }

#tab02 ol { display:none; height:54px; padding:5px; color:#666; }

#tab02 ol.up { display:block; }

#tab03 { position:relative; width:100px; margin:50px; }

#tab03 h3 { position:relative; z-index:1; height:16px; padding-top:4px; margin-bottom:-1px; border:solid #ccc; border-width:1px 0 1px 1px; text-align:center; font-family:宋体; background:#eee; cursor:pointer; }

#tab03 h3.up { z-index:3; color:#c00; background:#fff; }

#tab03 div.tab { display:none; position:absolute; left:99px; top:0; z-index:2; width:300px; height:200px; padding:5px; border:solid 1px #ccc; color:#666; }

#tab03 div.tab.up { display:block; }

-->

首页

嘿嘿,无视div原始class值。

源码安装软件卸载,ubuntu 香橙派,tomcat的发展趋势,爬虫python讲解,三级分销商城php,百度贴吧排名规则seolzw

测试

继续无视h3原始class值。

ktv app源码,ubuntu14密钥,tomcat第二天不能用,python爬虫网站密码,php内存溢出跟服务器有关,seo知识加强lzw

无聊

h3没有值也可以~

傻蛋

div没有值一样可以~

首页

嘿嘿,无视容器原始class值。

测试

继续无视h3原始class值。

无聊

h3没有值也可以~

傻蛋

div没有值一样可以~

首页

嘿嘿,无视h3原始class值。

测试

继续无视div原始class值。

无聊

h3没有值也可以~

傻蛋

class值相似一样也可以~

指定class后,即时再多一个div也行。

<!–

function Pid(id,tag){

if(!tag){

return document.getElementById(id);

}

else{

return document.getElementById(id).getElementsByTagName(tag);

}

} function tab(id,hx,box,iClass,s,pr){

var hxs=Pid(id,hx);

var boxs=Pid(id,box);

if(!iClass){ // 如果不指定class,则:

boxsClass=boxs; // 直接使用box作为容器

}

else{ // 如果指定class,则:

var boxsClass = [];

for(i=0;i<boxs.length;i++){

if(boxs[i].className.match(/\btab\b/)){// 判断容器的class匹配

boxsClass.push(boxs[i]);

}

}

}

if(!pr){ // 如果不指定预展开容器,则:

go_to(0); // 默认展开序列

yy();

}

else {

go_to(pr);

yy();

}

function yy(){

for(var i=0;i<hxs.length;i++){

hxs[i].temp=i;

if(!s){// 如果不指定事件,则:

s=”onmouseover”; // 使用默认事件

hxs[i][s]=function(){

go_to(this.temp);

}

}

else{

hxs[i][s]=function(){

go_to(this.temp);

}

}

}

}

function go_to(pr){

for(var i=0;i<hxs.length;i++){

if(!hxs[i].tmpClass){

hxs[i].tmpClass=hxs[i].className+=” “;

boxsClass[i].tmpClass=boxsClass[i].className+=” “;

}

if(pr==i){

hxs[i].className+=” up”; // 展开状态:标题

boxsClass[i].className+=” up”; // 展开状态:容器

}

else {

hxs[i].className=hxs[i].tmpClass;

boxsClass[i].className=boxsClass[i].tmpClass;

}

}

}

}

tab(“tab01″,”h3″,”div”,””,”onclick”,2); tab(“tab02″,”h4″,”ol”);tab(“tab03″,”h3″,”div”,”tab”);

//–>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。