您好,欢迎来到网站制作教程网!
css教程 css布局 web标准 浏览器兼容
access基础 mysql基础 sql server基础教程 oracle基础教程
fireworks教程 Dreamweaver教程 Flash教程 网页设计原理 网页欣赏
ASP基础教程 asp.net基础教程 html教程 xhtml教程 ajax教程 xml入门教程 正规则表达式
seo基础教程 策划盈利教程 建站基础
链接特效 导航特效 文本特效 日期时间特效 状态栏特效
javascript教程 vbscript教程
php与Smarty教程 php基础教程 php与数组教程 php与字符串教程 php与数据库
Web服务器教程 ftp服务器教程
ps制作网页元素 ps调色 ps抠图 ps照片美容 photoshop合成 ps文字效果 ps基础与技巧 coreldraw基础 ai基础 平面设计理论

横向、竖向排列的多种选项卡及滑动门效果

时间:2011-07-19 11:57来源:未知 作者:admin 点击:

横向、竖向排列的多种选项卡及滑动门效果

多种选项卡菜单,横向、竖向排列,有滑动门,也有需要点击才激活的滑动门(大家常说的选项卡),想用哪个你就用哪个,这里只是一种实现方法,选项卡色调什么的请根据您自己的网站风格修改下

效果图:


 

源程序:

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>dushuwu.net选项卡</title>
<style type="text/css">
<!--
* { 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; }
-->
</style>
</head>
<body>
<div id="tab01">
<h3>三分钟美文网</h3>
<div class="jj"><p>我的首页,放我自己的东西哦!</p></div>
<h3 class="pr">百味人生</h3>
<div><p>生活中的酸甜苦辣</p></div>
<h3>高校文章</h3>
<div><p>让你捧腹大笑</p></div>
<h3 class="box">人生哲理</h3>
<div><p>做人从这里开始</p></div>
</div>
<div id="tab02">
<h4>三分钟美文网</h4>
<ol class="pr"><li>三分钟美文网</li></ol>
<h4 class="box">三分钟美文网</h4>
<ol><li>经典美文</li></ol>
<h4>可爱</h4>
<ol><li>三分钟美文网</li></ol>
<h4 class="bb">笑话</h4>
<ol><li>讲个笑话听听吧?</li></ol>
</div>
<div id="tab03">
<h3>三分钟美文网</h3>
<div class="tab"><p>高品质美文网站</p></div>
<h3>三分钟</h3>
<div class="tab wushi"><p>高品质美文网站</p></div>
<h3>三分钟</h3>
<div class="tab"><p>高品质美文网站</p></div>
<h3 class="box">三分钟</h3>
<div class="tab tab123"><p>高品质美文网站</p></div></div>
</div>
<script type="text/javascript">
<!--
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){
boxsClass=boxs;
}
else{
var boxsClass = [];
for(i=0;i<boxs.length;i++){
if(boxs[i].className.match(/\btab\b/)){
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+=" pr1984_com";
boxsClass[i].tmpClass=boxsClass[i].className+=" pr1984_com";
}
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");
//-->
</script>
</body>
</html>


Tags:
网站制作教程
责任编辑:admin

发表评论

请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
验证码:点击我更换图片

最新评论

  • 网络营销
  • 服务器
  • 数据库