实用的Jquery选项卡TAB示例代码 - Web前端
作者:98wpeu发布时间:2026-06-09分类:网页前端技术浏览:3
导读:复制代码代码如下:<!DOCtypehtmlPUBLIC"-//W3C//DTDxhtml1.0Transitional//EN""http://www.w3....
复制代码 代码如下:
<!DOCtypehtml 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=utf-8" />
<title>实用的JQuery选项卡</title>
<script language="javascript" type="text/JavaScript" src="jQuery-1.9.1.min.JS"></script>
<style type="text/CSS">
.order_box .stitle {
width: 825px;
clear: right;
height: 27px;
border-bottom: 2px solid #A10000;
}
.order_box .stitle .close {
width: 80px;
height: 18px;
border-top: 1px solid #dedede;
border-left: 1px solid #dedede;
border-right: 1px solid #dedede;
background: #f1f1f1;
color: #000;
text-align: center;
float: left;
margin-right: 5px;
padding-top: 8px;
}
.order_box .stitle .open {
width: 82px;
height: 20px;
background: #A10000;
color: #fff;
text-align: center;
float: left;
margin-right: 5px;
padding-top: 8px;
overflow: hidden;
}
.order_box ul li {
cursor: pointer;
display: list-item;
list-style:none;
}
</style>
<script type="text/Javascript">
//选项卡切换
$(function () {
$(".stitle li").click(function () {
var index_tab = $(this).parent().children().index($(this)); //选项卡的索引值
$(this).parent().find(".open").removeclass("open").addClass("close"); //选项卡背景处理
$(this).removeClass("close").addClass("open");
var content_obj = $(".cntorder") //内容节点
content_obj.hide();
content_obj.eq(index_TAB).show();
});
});
</script>
</head>
<body>
<div class="order_box">
<div class="stitle">
<ul>
<li class="open">进行中</li>
<li class="close">已完成</li>
<li class="close">无效</li>
</ul>
</div>
<div class="cntorder" >tab1</div>
<div class="cntorder" style="display: none;">tab2</div>
<div class="cntorder" style="display: none;">tab3</div>
</div>
</body>
</html>
<!DOCtypehtml 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=utf-8" />
<title>实用的JQuery选项卡</title>
<script language="javascript" type="text/JavaScript" src="jQuery-1.9.1.min.JS"></script>
<style type="text/CSS">
.order_box .stitle {
width: 825px;
clear: right;
height: 27px;
border-bottom: 2px solid #A10000;
}
.order_box .stitle .close {
width: 80px;
height: 18px;
border-top: 1px solid #dedede;
border-left: 1px solid #dedede;
border-right: 1px solid #dedede;
background: #f1f1f1;
color: #000;
text-align: center;
float: left;
margin-right: 5px;
padding-top: 8px;
}
.order_box .stitle .open {
width: 82px;
height: 20px;
background: #A10000;
color: #fff;
text-align: center;
float: left;
margin-right: 5px;
padding-top: 8px;
overflow: hidden;
}
.order_box ul li {
cursor: pointer;
display: list-item;
list-style:none;
}
</style>
<script type="text/Javascript">
//选项卡切换
$(function () {
$(".stitle li").click(function () {
var index_tab = $(this).parent().children().index($(this)); //选项卡的索引值
$(this).parent().find(".open").removeclass("open").addClass("close"); //选项卡背景处理
$(this).removeClass("close").addClass("open");
var content_obj = $(".cntorder") //内容节点
content_obj.hide();
content_obj.eq(index_TAB).show();
});
});
</script>
</head>
<body>
<div class="order_box">
<div class="stitle">
<ul>
<li class="open">进行中</li>
<li class="close">已完成</li>
<li class="close">无效</li>
</ul>
</div>
<div class="cntorder" >tab1</div>
<div class="cntorder" style="display: none;">tab2</div>
<div class="cntorder" style="display: none;">tab3</div>
</div>
</body>
</html>
相关推荐
- jquery 跳到顶部和底部动画2句代码简单实现 - Web前端
- jQuery 顶部导航跟随滚动条滚动固定浮动在顶部 - Web前端
- 多个datatable共存造成多个表格的checkbox都被选中 - Web前端
- jQuery Animation实现CSS3动画示例介绍 - Web前端
- jquery实现漂浮在网页右侧的qq在线客服插件示例 - Web前端
- Jquery实现鼠标移上弹出提示框、移出消失思路及代码 - Web前端
- jquery实现的一个导航滚动效果具体代码 - Web前端
- jQuery数据缓存功能的实现思路及简单模拟 - Web前端
- jQuery解决下拉框select设宽度时IE 6/7/8下option超出显示不全 - Web前端
- jQuery 过滤方法filter()选择具有特殊属性的元素 - Web前端
- 网页前端技术排行
- 最近发表
-
- WordPress随机显示特色图片插件:Random Post Thumbnails
- KeePass实现Chrome浏览器自动填充密码方法一
- LNMP一键包nginx 301强制跳转到https教程
- KeePass实现Chrome浏览器自动填充密码方法二
- #建站# 免费的VPS管理软件Xshell8/Xftp8中文版下载
- 使用Xshell 8连接VPS教程_电脑登录vps的方法
- WordPress评论界面添加烟花????效果
- 不同浏览器书签同步方案:坚果云+Floccus_详细使用教程
- iOS端KeePassXC客户端APP:Strongbox Password Safe
- 给WordPress评论中的Gravatar头像图片添加ALT属性


