<!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>兼容性好的TAB选项卡(IE,FF,Opera,Safari,Chrome)</title>
<style type="text/css">
#tab_container1{width:600px;text-align:left;}
.cls_tab_nav{height:26px;overflow:hidden;font-size:12px;text-align:left;background:url(http://www.codefans.net/jscss/demoimg/tabs/line_bg.jpg) repeat-x bottom;}
.cls_tab_nav ul{font-size:9pt;margin:0;padding:0;}
.cls_tab_nav_li{background:url(http://www.codefans.net/jscss/demoimg/tabs/tab_bg.jpg) no-repeat -157px 0;width:157px;height:26px;line-height:26px;float:left;display:inline;overflow:hidden;text-align:center;cursor:pointer;}
.cls_tab_nav_li_first{background-position:0px 0px;}
.cls_tab_nav_li a{text-decoration:none;color:#555;font-size:12px;}
.cls_tab_body{border:1px solid #FFAE1E;border-top:none;min-height:260px;padding:20px;}
.cls_div{display:none;font-size:14px;}
</style>
</head>
<body>
<div id="tab_container1">
<div class="cls_tab_nav">
<ul>
<li class="cls_tab_nav_li cls_tab_nav_li_first"><a href="#">最新更新</a></li>
<li class="cls_tab_nav_li"><a href="#">ASP类更新</a></li>
<li class="cls_tab_nav_li"><a href="#">C#类更新</a></li>
</ul>
</div>
<div class="cls_tab_body">
<div class="cls_div" style="display:block;">
这里是最新更新的显示内容
</div>
<div class="cls_div">ASP的内容</div>
<div class="cls_div">C#的内容/</div>
</div>
</div>
<script type="text/javascript">
try{
document.execCommand("BackgroundImageCache", false, true);
}catch(e){}
function $(element){
if(arguments.length>1){
for(var i=0,elements=[],length=arguments.length;i<length;i++)
elements.push($(arguments[i]));
return elements;
}
if(typeof element=="string")
return document.getElementById(element);
else
return element;
}
var Class={
create:function(){
return function(){
this.initialize.apply(this,arguments);
}
}
}
Object.extend=function(destination,source){
for(var property in source){
destination[property]=source[property];
}
return destination;
}
var tabMenu=Class.create();
tabMenu.prototype={
initialize:function(container,selfOpt,otherOpt){
this.container=$(container);
var selfOptions=Object.extend({fontWeight:"bold",fontSize:"12px",color:"#FFBC44"},selfOpt||{});
var otherOptions=Object.extend({fontWeight:"normal",fontSize:"12px",color:"#666"},otherOpt||{});
//用for循环得到objs数组,主要是为了兼容非IE浏览器把空白也当作子对象
for(var i=0,length=this.container.childNodes.length,objs=[];i<length;i++){
if(this.container.childNodes[i].nodeType==1)
objs.push(this.container.childNodes[i]);
}
var tabArray=objs[0].getElementsByTagName("li");
//用for循环得到divArray数组,主要是为了兼容非IE浏览器把空白也当作子对象
var divArray=new Array();
for(i=0,length=objs[1].childNodes.length;i<length;i++){
if(objs[1].childNodes[i].nodeType==1)
divArray.push(objs[1].childNodes[i]);
}
for(i=0,length=tabArray.length;i<length;i++){
tabArray[i].length=length;
tabArray[i].index=i;
tabArray[i].onmouseover=function(){
//其它选项卡样式设置
for(var j=0;j<this.length;j++){
tabArray[j].style.backgroundPosition="-"+tabArray[j].offsetWidth+"px 0";
for(var property in selfOptions){
tabArray[j].firstChild.style[property]=otherOptions[property];
}
}
//当前选项卡样式
this.style.backgroundPosition="0 0";
for(var property in selfOptions){
this.firstChild.style[property]=selfOptions[property];
/*
注意this.style.property和selfOptions.property的用法错误
style.fontWeight正确
style["fontWeight"]正确
style["font-weight"]错误
*/
}
//隐藏其它选项卡
for(j=0;j<this.length;j++){
divArray[j].style.display="none";
}
//显示当前选项卡
divArray[this.index].style["display"]="block";
}
}
}
}
var tab1=new tabMenu("tab_container1",{fontSize:"14px",color:"#FFBC44",fontWeight:"bold"},{fontWeight:"normal",color:"#666"});
</script>
</body>
</html>
分享到:
相关推荐
17. **9号源码中心** (http://www.9code.com/):提供各类网站源码,包括企业网站、商城系统等。 18. **网馨源码** (http://www.asppsa.com/):以ASP.NET源码为主,同时包含其他编程语言的源码。 19. **源码天下** ...
项目 SVN : https://svn.code.sf.net/p/l2jopensource/projects/ Interlude aCis 382 (最新稳定版) https://svn.code.sf.net/p/l2jopensource/projects/Interlude/L2J_aCis/ aCis_382_LATEST_STABLE/ aCis 389(最新...
大幅http://hi.csdn.net/invite.php?u=325297&c=1ace3e55fd7f56be
教程/考题/范本/读物下载:http://zl.mydown.com 读编交流区:... 源码/网页模板下载:http://download.yesky.com/code/codedown.html 读编交流区:http://comments.yesky.com/t/212861/0,0/0.shtml
.NET 是一个由微软开发的开源框架,它提供了一套全面的开发工具和服务,用于构建跨平台的应用程序,包括桌面应用、Web 应用、移动应用以及云服务。.NET 文档是学习和掌握这个框架的重要资源,官方文档详细介绍了从...
具体从http://www.okbase.net/jscss/code/1866.shtml提取中间演示textarea内的html文本,从(网页特效代码)->(详细分类)->html网页中textarea内容,程序内使用了1.多线程 2.正则表达式 3.web文件读取 4.本地文件...
ASP.NET 是一种基于微软.NET Framework的服务器端网页开发平台,它允许开发人员创建交互式的、动态的Web应用程序。在这个场景中,我们关注的是如何利用ASP.NET来调用百度天气API,以获取并显示特定城市的未来三天...
下载地址:http://www.codefans.net/soft/2111.shtml 自带安装程序,配置简便,界面清新,深受很多朋友喜欢,UTF-8演示地址查看:http://www.codefans.net/guestbook/ 1、全新DIV+CSS,HTML代码更简洁; 2...
[license]https://download.csdn.net/download/qq345162168/12579760 [part1]https://download.csdn.net/download/qq345162168/12579642 [part2]https://download.csdn.net/download/qq345162168/12579654 [part3]...
Bootstrap4 支持,含有超过50个模板...Rickshaw http://code.shutterstock.com/rickshaw/ Spectrum https://bgrins.github.io/spectrum/ SpinKit http://tobiasahlin.com/spinkit/ Summernote https://summernote.org/
保存模板图片及CSS样式的目录 _template -- 模板文件目录 保存所有模板文件,如果要修改模板请修改此目录的文件 js -- JS文件目录 保存所有必须的JS文件,如导航滑动效果 USERS -- 用户文件目录 用户登陆...
Quickly use: build.gradle in the project directory to add the following code: allprojects { repositories { ... maven { url 'https://jitpack.io' } } } Introduced dependencies in the ap
下载地址:http://fancybox.googlecode.com/files/jquery.fancybox-1.2.5.zip 演示实例:http://fancybox.net/example 4.jQueryUI Dialog 官方网站:http://jqueryui.com/demos/dialog/ 下载地址:...
这是第二分卷。 一共5个分卷。全部下载后,用好压压缩软件打开。 好压软件下载地址:http://www.haozip.com/download.htm 第一部分:...第五部分:http://download.csdn.net/source/3121724
http://blog.csdn.net/gjldwz/article/details/50555922 Multiple annotations found at this line: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element '...
好压软件下载地址http://www.haozip.com/download.htm 第一部分:http://download.csdn.net/source/3121697 第二部分:http://download.csdn.net/source/3121705 第三部分:...
标题 "activities-agency code" 暗示我们讨论的是一段与活动代理相关的代码,可能是用于构建一个在线活动管理或代理服务的网站。这个代码可能涉及到用户交互、数据处理、界面设计等多个方面。描述提到 "this is a ...
参考对应文章说明:https://yydatav.blog.csdn.net/article/details/130713906 1. 前后端分离:前端 Echarts JavaScript BootStrap; 后端Python Flask; 2. 数据动态更新:服务端触发数据源的变化,前端AJAX自动...
与标题一致的描叙,你值得拥有,确实很值。来赚分啦。 参考下面大侠而来 http://blog.csdn.net/xutaozero21/article/details/4873439 ...http://www.blogjava.net/lizongbo/archive/2006/12/04/85433.html
Netty在Android开发中的应用实战系列(一)——— 搭建服务端与客户端:https://azhon.blog.csdn.net/article/details/100569489 Netty在Android开发中的应用实战系列(二)——— Encoder | Decoder | Handler 的...