1. <script type="text/javascript">
  2. /*
  3. tab切换选项卡js效果 writed by *** 2010.08.13
  4.  
  5. 1.currentid:string 当前被激活菜单的id;
  6. 2.otherids:Array() 其它未被激活的id;
  7. 3.tabclasses:Array() tab被激活时的样式类+tab未被激活时的样式类,存储两个值即可
  8. */
  9. function chaneTab(currentid,otherids,tabclasses){
  10.  
  11. var tagPrefix="tab";
  12. var conPrefix="con";
  13. //显示:
  14. document.getElementById(tagPrefix+currentid).className=tabclasses[0];
  15. document.getElementById(conPrefix+currentid).style.display="block";
  16. //隐藏:
  17. for(var i=0;i<otherids.length;i++){
  18. document.getElementById(tagPrefix+otherids[i]).className=tabclasses[1];
  19. document.getElementById(conPrefix+otherids[i]).style.display="none";
  20.  
  21. }
  22. }
  23.  
  24. </script>

应用代码:

  1. <div class="right_centerzbt ml10">
  2. <div class="tou">
  3. <ul class="mt50">
  4. <li onmouseover="chaneTab('001',new Array('002'),new Array('center_bj',''))" id="tab001" class="center_bj"><a>名山明星榜</a></li>
  5. <li onmouseover="chaneTab('002',new Array('001'),new Array('center_bj',''))" id="tab002"><a>热门群组</a></li>
  6. </ul>
  7. </div>
  8. <div id="con001" style="display: block;" class="right_content1 l bl br bb">
  9. <iframe width="680" height="391" frameborder="0" scrolling="no" style="margin-left: -1px;" border="0" marginheight="0" marginwidth="0" src="shequ/uchome/do.php?ac=ajax&amp;op=getindexspace"></iframe>
  10. </div>
  11. <div id="con002" style="display: none;" class="right_content1 l bl br bb">
  12. <ol class="mt10 ml10">
  13. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=23"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/128142654112531.jpg"></a></li>
  14. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=23"><b>武林英雄官方群</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=23">0</a></span>)</li>
  15. <li class="ml5"></li>
  16. <li class="ml5">主题:<span>0</span>,贴数:<span>0</span></li>
  17. </ol>
  18. <ol class="mt10 ">
  19. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=14"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/128142678521940.jpg"></a></li>
  20. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=14"><b>游戏贴图</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=14">0</a></span>)</li>
  21. <li class="ml5">这里是维客分享与会员互动区。您的...</li>
  22. <li class="ml5">主题:<span>0</span>,贴数:<span>0</span></li>
  23. </ol>
  24. <ol class="mt10 ml10">
  25. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=20"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/12814265524528.jpg"></a></li>
  26. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=20"><b>三国群英传官方群</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=20">0</a></span>)</li>
  27. <li class="ml5"></li>
  28. <li class="ml5">主题:<span>1</span>,贴数:<span>1</span></li>
  29. </ol>
  30. <ol class="mt10 ">
  31. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=18"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/128142657314254.jpg"></a></li>
  32. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=18"><b>飘渺仙剑客服群</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=18">0</a></span>)</li>
  33. <li class="ml5"></li>
  34. <li class="ml5">主题:<span>0</span>,贴数:<span>0</span></li>
  35. </ol>
  36. <ol class="mt10 ml10">
  37. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=17"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/128142658426959.jpg"></a></li>
  38. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=17"><b>武林英雄客服群</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=17">0</a></span>)</li>
  39. <li class="ml5"></li>
  40. <li class="ml5">主题:<span>1</span>,贴数:<span>1</span></li>
  41. </ol>
  42. <ol class="mt10 ">
  43. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=25"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/12814265147740.jpg"></a></li>
  44. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=25"><b>飘渺仙剑官方群</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=25">0</a></span>)</li>
  45. <li class="ml5"></li>
  46. <li class="ml5">主题:<span>0</span>,贴数:<span>0</span></li>
  47. </ol>
  48. <ol class="mt10 ml10">
  49. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=13"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/128142679512873.jpg"></a></li>
  50. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=13"><b>游戏交友</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=13">0</a></span>)</li>
  51. <li class="ml5">记录管理人员的意见或建议。</li>
  52. <li class="ml5">主题:<span>0</span>,贴数:<span>0</span></li>
  53. </ol>
  54. <ol class="mt10 ">
  55. <li class="quanzi_pic ml10"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=15"><img onerror="this.onerror=null;this.src='';" src="http://192.168.0.113/shequ/uchome/upload/2010-08/128142677312935.jpg"></a></li>
  56. <li class="ml5"><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=15"><b>游戏交易</b></a>(今日:<span><a target="_blank" href="shequ/uchome/space.php?do=mtag&amp;tagid=15">0</a></span>)</li>
  57. <li class="ml5">生活中的小窍门,都拿出来和大家分...</li>
  58. <li class="ml5">主题:<span>0</span>,贴数:<span>0</span></li>
  59. </ol>
  60. </div>
  61.  
  62. </div>

效果图:

From: http://www.cnblogs.com/xiaochaohuashengmi/archive/2010/08/16/1800711.html

更多JS实用代码:http://www.cnblogs.com/xiaochaohuashengmi/archive/2010/08/16/1800711.html

Tab选项卡切换卡JS效果的更多相关文章

  1. 纯js实现网页tab选项卡切换效果

    纯js实现网页tab选项卡切换效果 百度搜索     js 点击菜单项就可以切换内容的效果

  2. 下拉菜单效果和tab选项卡切换

    //下拉菜单效果和tab选项卡切换. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...

  3. vue实现tab选项卡切换效果

    tab选项卡切换效果: 通过点击事件传入参数,然后通过v-show来进行切换显示 <template> <div class="box"> <div ...

  4. 7月新的开始 - LayUI的基本使用 - Tab选项卡切换显示对应数据

    LayUI tab选项卡+page展示 要求:实现tab选项卡改变的同时展示数据也跟着改变 实现条件: 1. 选项卡 [官网 – 文档/示例 – 页面元素 – 选项卡] 2.数据表格 [官网 – 文档 ...

  5. LayUI的基本使用 - Tab选项卡切换显示对应数据

    要求:实现tab选项卡改变的同时展示数据也跟着改变 实现条件: 1. 选项卡 [官网 – 文档/示例 – 页面元素 – 选项卡] 2.数据表格 [官网 – 文档/示例 – 内置模块 – 数据表格] 3 ...

  6. react tab选项卡切换

    Tab选项卡切换是个很常见也很简单的小功能,用原生js和jq去写的话可能不到20行代码就搞定so easy.但是用react去实现就没那么容易了(是自己react比较菜).由于最近在重新学习react ...

  7. 纯CSS实现tab选项卡切换

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta cont ...

  8. 微信小程序Tab选项卡切换大集合

    代码地址如下:http://www.demodashi.com/demo/14028.html 一.前期准备工作 软件环境:微信开发者工具 官方下载地址:https://mp.weixin.qq.co ...

  9. Axure实现Tab选项卡切换功能

    这几天用Axure画原型图的过程中,须要实现Tab选项卡切换的效果,但Axure中并没有类似于Tab控件的部件,所以能够用Axure中的动态面板(Dynamic Panel)来实现. 本文以已经汉化的 ...

随机推荐

  1. tmux复制到windows剪贴板/粘贴板的坑

    以下所有操作都是在windows下面用putty连接linux centos6的情景下. 一直很纳闷为什么在tmux模式下不能把复制到的文字放到系统的粘贴板里面呢?通过层层阻碍,终于找到了原因. 去掉 ...

  2. [CLR VIA C#] chapter2 building,packaging,deploying, and administering

    今天整理一下 assembly, 总感觉第一章 到 第三章 没怎么仔细看, 导致后面作者说前面说过的, 我就心里不舒服, 前面3章很干很涩, 好好啃啃, 先作一些简单笔记, 最后再来 整体整理, 反正 ...

  3. demo_07选择器练习

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  4. 如何解决PHP中文乱码问题

    如何解决PHP中文乱码问题 一.解决HTML中中文乱码问题方法    1.在head标签里面加入UTF8编码(国际化编码):UTF-8是没有国家的编码,也就是独立于任何一种语言,任何语言都可以使用的. ...

  5. HTML5 改良的 input 元素的种类

    html5中增加改良的input 元素 . 在过去我们制作网页输入框,会用到不少JS验证,如今有了HTML5写这种效果已经没有那么麻烦了,下面我来给大家介绍两种HTML5的input的新增加的类型应用 ...

  6. windows下的SASS/Compass的安装与卸载

    认识SASS/Compass SASS是一种CSS的开发工具,提供了许多便利的写法,大大节省了设计者的时间,使得CSS的开发,变得简单和可维护. SASS与Compass的安装说明 SASS在Wind ...

  7. c# datagridview导出到excel【转载】

    c# datagridview导出到excel[转载] http://hi.baidu.com/weizier/blog/item/8212caea1123b4d6d439c9fe.html 本作者使 ...

  8. Highchart :tooltip工具提示

    Highcharts翻译系列之十六:tooltip工具提示tooltip工具提示 参数 描述 默认值 animation 启用或禁用提示的动画.这对大数据量的图表很有用 true background ...

  9. Java笔记1 : 在生产者消费者模式中,线程通信与共享数据,死锁问题与解决办法

    本例定义了4个类,这里说一下,方便下面讲解.分别是Product(产品),Producer(生产者),Consumer(消费者), Test(测试类). 多线程之间通信与共享数据只要引用同一内存区域就 ...

  10. 启动Tomcat出现Using CATALINA_BASE

    有一次命令行启动Tomcat的时候,出现: Using CATALINA_BASE: "D:\apache-tomcat-6.0.35"Using CATALINA_HOME: & ...