JavaScript 复选框全选效果&JQuery 实现简单的tab切换效果
2014-03-22 08:20
1216 查看
JavaScrip实现复选框全选的关键代码!
function checkall(){
varstr=document.getElementsByName("p");
for(vari=0;i<str.length;i++){
str[i].checked=document.getElementById("all").checked;
}
}
------------------------------------------------------------------------------------------------------
单击实现切换
<html>
<head>
<title></title>
<scripttype="text/javascript"src="../js/jquery-1.8.3.js"></script>
<scripttype="text/javascript">
$(document).ready(function(){
$("#tabtopul li").click(function(){
$(this).addClass("on");
$(this).siblings("li").removeClass("on");
$(".content").hide();
$(".content").eq($(this).index()).show(1000);
});
});
</script>
<style>
ul{
list-style:none;
}
ulli{
display:inline;
margin-left:10px;
}
.on{
border:1pxsolid red;
border-top:2pxsolid blue;
border-bottom:none;
background-color:gray;
}
</style>
</head>
<body>
<div>
<divid="tabtop">
<ul>
<liclass="on">我的订单</li>
<li>我的团购</li>
</ul>
</div>
<divclass="content">
<imgsrc="../images/spring.jpg">//图片路径
</div>
<divclass="content" style="display:none">
<imgsrc="../images/summer.jpg">//图片路径
</div>
</div>
</body>
</html>
function checkall(){
varstr=document.getElementsByName("p");
for(vari=0;i<str.length;i++){
str[i].checked=document.getElementById("all").checked;
}
}
------------------------------------------------------------------------------------------------------
单击实现切换
<html>
<head>
<title></title>
<scripttype="text/javascript"src="../js/jquery-1.8.3.js"></script>
<scripttype="text/javascript">
$(document).ready(function(){
$("#tabtopul li").click(function(){
$(this).addClass("on");
$(this).siblings("li").removeClass("on");
$(".content").hide();
$(".content").eq($(this).index()).show(1000);
});
});
</script>
<style>
ul{
list-style:none;
}
ulli{
display:inline;
margin-left:10px;
}
.on{
border:1pxsolid red;
border-top:2pxsolid blue;
border-bottom:none;
background-color:gray;
}
</style>
</head>
<body>
<div>
<divid="tabtop">
<ul>
<liclass="on">我的订单</li>
<li>我的团购</li>
</ul>
</div>
<divclass="content">
<imgsrc="../images/spring.jpg">//图片路径
</div>
<divclass="content" style="display:none">
<imgsrc="../images/summer.jpg">//图片路径
</div>
</div>
</body>
</html>
相关文章推荐
- jQuery实现Tab选项卡切换效果简单演示
- jQuery简单tab切换效果实现方法
- jQuery简单实现tab选项卡切换效果
- jquery实现简单Tab切换菜单效果
- jquery实现的非常简单实用带有渐变切换效果的tab选项卡
- js(JavaScript)实现TAB标签切换效果的简单实例
- jquery 简单两步实现tab切换效果
- jQuery实现Tab选项卡切换效果简单演示
- js(JavaScript)实现TAB标签切换效果的简单实例
- jQuery实现一个全选复选框联动效果
- 完美JQuery图片切换效果的简单实现
- JS实现简单的tab切换选项卡效果
- javascript(jQuery版)切换tab效果自动切换(转自www.jqueryba.com)
- bootstrap+jQuery 实现下拉菜单中复选框全选和全不选效果
- 简单几行js实现tab选项切换效果
- jquery实现tab标签选项卡自动切换效果
- jquery实现初次打开有动画效果的网页TAB切换代码
- jQuery实现选项卡切换效果简单演示
- jQuery实现TAB风格的全国省份城市滑动切换效果代码
- [转]javascript应用:实现复选框全选/全不选切换