JS 仿IE7 126邮箱 傲游 标签 选项卡(更新下载地址)

 

JsTab.html:

<html xmlns="http://www.w3.org/1999/xhtml">
< head>
< meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
< title>JS 仿IE7 126邮箱 傲游 标签 选项卡</title>
< script src="jstablib.js" type="text/javascript"></script>
< link rel="stylesheet" href="jstab.css" />
< style>
.mnu{padding-top:30px}
.mnu a{margin:1px 1px 1px 3px; border:1px solid #0066FF; display:block; color:#000066; font-size:14px; padding:5px; text-decoration:none; background:#DCECFA }

</style>
< /head>

<body>
< table width="100%" border="0" cellspacing="0" height="100%" cellpadding="0">
< tr>
     <td width="10%" valign="top" class="mnu">
< a href="javascript:fOpenTab('links/1.html','页面1');">页面1</a>
< a href="javascript:fOpenTab('links/2.html','页面2');">页面2</a>
< a href="javascript:fOpenTab('links/3.html','页面3');">页面3</a>
< a href="javascript:fOpenTab('links/4.html','页面4');">页面4</a>

< /td>
     <td width="90%" align="left" valign="top">

< table width="100%" border="0" cellspacing="0" height="100%" cellpadding="0">
       <tr><td valign="top" style="height:28px;"><div class="gTab" id="dvTab"></div></td></tr>
       <tr><td><div class="tabcon" id="tabcon"></div></td></tr>
     </table>  
  
< /td>
< /tr>
< /table>
< script type="text/javascript">fInitTabCtrl();</script>
< /body>
< /html>

jstablib.js

function getE(id){return document.getElementById(id);}
var sHomeIframeUrl="links/home.html";
var ids={};
ids.tabnav="dvTab";
ids.tabcon="tabcon";
var iTab=1;

var otab = {};
otab.tab="<table border='0' cellspacing='0' cellpadding='0' class='tabsel' title='{title}' \
style='width:124px' tabid='outLink_{id}' id='outLink_{id}'> \
< tr><td class=tLe> </td><td class=bdy \
οnclick=\"fShowTab('{id}')\"><nobr>{title}</nobr></td> \
< td class=btn><a class='TabCls' hideFocus title='关闭' \
href=\"javascript:fClose('{id}')\"> </a></td> \
< td class=tRi> </td></tr></table>";
otab.frm='<iframe id="tabfrm_{id}" scrolling="auto" src="{url}" \
style="height:100%;width:100%;" frameborder="0"></iframe>';

function fOpenTab(url,title){

//对存在的显示
var op=getE(ids.tabcon);
for(var i = 0;i<op.childNodes.length;i++){
    if(op.childNodes[i].src==url){
     var showid = op.childNodes[i].id;
     fShowTab(showid.replace("tabfrm_",""));
     return;
    }
} 

//对不存在的添加
var s=otab.tab.replace(/{title}/g,title);
s=s.replace(/{id}/g,iTab);

var frm=otab.frm.replace(/{id}/g,iTab);
frm=frm.replace(/{url}/g,url);

getE(ids.tabnav).innerHTML=getE(ids.tabnav).innerHTML+s;
getE(ids.tabcon).innerHTML=getE(ids.tabcon).innerHTML+frm;
fShowTab(iTab);

iTab++;
}
function fShowTab(tableid){
var op=getE("tabfrm_"+tableid).parentNode;
var opt=getE("outLink_"+tableid).parentNode; 
for(var i = 0;i<op.childNodes.length;i++){
    if(op.childNodes[i].id=="tabfrm_"+tableid){
     op.childNodes[i].style.display="block";
     opt.childNodes[i].className="tabsel";  
    }else{
     op.childNodes[i].style.display="none";
     opt.childNodes[i].className="tab"; 
    }
}
}
function fClose(tableid){

//如果是全部关闭
if(tableid=="_1"){
    //移除全部 不用fInitTabCtrl(),防重装载
    o=getE(ids.tabnav);
    of=getE(ids.tabcon);
    var chlen=o.childNodes.length;
    for(var i=2;i<chlen;i++){
     o.removeChild(o.childNodes[2]);
     of.removeChild(of.childNodes[2]);
    }
    o.childNodes[0].style.display="none";//关闭所有按钮
    o.childNodes[1].className="tabsel";//主页
    of.childNodes[1].style.display="block";
    iTab=1;
    return; 
}
//移除
var o=getE("outLink_"+tableid);
o.parentNode.removeChild(o);

var of=getE("tabfrm_"+tableid);
var disp=of.style.display;
of.parentNode.removeChild(of);

//如果关闭的是隐藏的标签,直接返回
if(disp=="none") return;

//否则显示最后一个
o=getE(ids.tabnav); 
if(o.childNodes && o.childNodes[o.childNodes.length-1]){
    var lastid= o.childNodes[o.childNodes.length-1].id;
    fShowTab(lastid.replace("outLink_",""));
}
}

function fInitTabCtrl(){

var homeTab=otab.tab.replace(/{title}/g,"首页");
homeTab=homeTab.replace("<td class=btn><a class='TabCls' hideFocus title='关闭' \
href=\"javascript:fClose('{id}')\"> </a></td>","");
homeTab=homeTab.replace(/nobr/g,"div");
homeTab=homeTab.replace("width:124px","width:50px");
homeTab=homeTab.replace(/{id}/g,0);

var homeIframe=otab.frm.replace(/{id}/g,0);
homeIframe=homeIframe.replace(/{url}/g,sHomeIframeUrl);

getE(ids.tabcon).innerHTML=homeIframe;
getE(ids.tabnav).innerHTML=homeTab;
}

jstablib_ch.js
function fOpenTab(url,title){
window.parent.fOpenTab(url,title);
}
jstab.css

body{margin:2px 2px 0px 2px; overflow:hidden;}
.tabcon iframe{}
.gTab table td nobr{width:100px; overflow:hidden;text-overflow:ellipsis;}
.gTab{ border-bottom:2px solid #6e96c5; text-align:left; margin:0px; height:28px;}
.gTab .tab,.gTab .tabsel{ height:28px;cursor:default; display:inline; margin:0px;}

.gTab .tab .tLe,.gTab .tabsel .tLe{width:4px; font-size:0px; }
.gTab .tab .tRi,.gTab .tabsel .tRi{width:4px; font-size:0px;}

.gTab .tab .tLe{background:url(images/tab/left0.gif) right bottom no-repeat; }
.gTab .tab .bdy{background:url(images/tab/center0.gif) left bottom repeat-x;color:gray;font-size:12px;padding:10px 0px 0px 3px;}
.gTab .tab .tRi{background:url(images/tab/right0.gif) left bottom no-repeat;}

.gTab .tab .btn{width:10px;background:url(images/tab/center0.gif) left bottom repeat-x;}
.gTab .tab .btn a{text-decoration:none; cursor:default; display:block; width:8px; height:10px; background:url(images/tab/close0.gif) left bottom no-repeat;}
.gTab .tab .btn a:hover{background:url(images/tab/close1.gif) left bottom no-repeat;}

.gTab .tabsel .tLe{background:url(images/tab/left2.gif) right bottom no-repeat;}
.gTab .tabsel .bdy{background:url(images/tab/center2.gif) left bottom repeat-x ;color:black;font-size:12px;font-weight:bold;padding:8px 0px 0px 3px;}
.gTab .tabsel .tRi{background:url(images/tab/right2.gif) left bottom no-repeat; }
.gTab .tabsel .btn{width:10px;background:url(images/tab/center2.gif) left bottom repeat-x;}
.gTab .tabsel .btn a{text-decoration:none; cursor:default; display:block; width:8px; height:10px; background:url(images/tab/close0.gif) left bottom no-repeat; margin-bottom:3px;}
.gTab .tabsel .btn a:hover{background:url(images/tab/close1.gif) left bottom no-repeat;}

home.html

<!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=gb2312" />
< title>无标题文档</title>
< script src="../jstablib_ch.js" type="text/javascript"></script>
< /head>

<body style="padding-bottom:600px;">
这是管理首页<br />
< a href="javascript:fOpenTab('links/1.html','页面1');">页面1</a>
< a href="javascript:fOpenTab('links/2.html','页面2');">页面2</a>
< a href="javascript:fOpenTab('links/3.html','页面3');">页面3</a>
< a href="javascript:fOpenTab('links/4.html','页面4');">页面4</a>
< /body>
< /html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ljfblog

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值