教程集 www.jiaochengji.com
教程集 >  脚本编程  >  javascript  >  正文 javascript自动切换选项卡效果

javascript自动切换选项卡效果

发布时间:2016-12-02   编辑:jiaochengji.com
教程集为您提供javascript自动切换选项卡效果等资源,欢迎您收藏本站,我们将为您提供最新的javascript自动切换选项卡效果资源
本文章来总结一款javascript自动切换选项卡效果,全js的哦,有需要的朋友可参考参考。
提示:您可以先修改部分代码再运行

<textarea name="runcool" rows="28" cols="75" > <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>自动切换选项卡</title> <style type="text/css"> *{list-style:none;margin:0;padding:0;overflow:hidden} .tab1{width:401px;border-top:#A8C29F solid 1px;border-bottom:#A8C29F solid 1px;margin:50px 200px;} .menu{width:400px;background:#eee;height:28px;border-right:#A8C29F solid 1px;border-bottom:#A8C29F solid 1px;} li{float:left;width:99px;text-align:center;line-height:28px;height:28px;cursor:pointer;border-left:#A8C29F solid 1px;color:#666;font-size:14px;overflow:hidden} .menudiv{width:399px;height:300px;border-left:#A8C29F solid 1px;border-right:#A8C29F solid 1px;border-top:0;background:#fefefe} .menudiv div{padding:15px;line-height:28px;} .off{background:#E0E2EB;color:#336699;font-weight:bold} </style> <script type="text/javascript"> function setTab(name,cursel){ cursel_0=cursel; for(var i=1; i<=links_len; i ){ var menu = document.getElementById(name i); var menudiv = document.getElementById("con_" name "_" i); if(i==cursel){ menu.className="off"; menudiv.style.display="block"; } else{ menu.className=""; menudiv.style.display="none"; } } } function Next(){ cursel_0 ; if (cursel_0>links_len)cursel_0=1 setTab(name_0,cursel_0); } var name_0='one'; var cursel_0=1; var ScrollTime=3000;//循环周期(毫秒) var links_len,iIntervalId; onload=function(){ var links = document.getElementById("tab1").getElementsByTagName('li') links_len=links.length; for(var i=0; i<links_len; i ){ links[i].onmouseover=function(){ clearInterval(iIntervalId); this.onmouseout=function(){ iIntervalId = setInterval(Next,ScrollTime);; } } } document.getElementById("con_" name_0 "_" links_len).parentNode.onmouseover=function(){ clearInterval(iIntervalId); this.onmouseout=function(){ iIntervalId = setInterval(Next,ScrollTime);; } } setTab(name_0,cursel_0); iIntervalId = setInterval(Next,ScrollTime); }
</body></textarea>
提示:您可以先修改部分代码再运行

您可能感兴趣的文章:
jquery自动切换tabs选项卡的实现代码
jquery自动切换tabs选项卡的具体实现
JQuery Tab选项卡效果代码改进版
jQuery学习笔记(3)--用jquery(插件)实现多选项卡功能
javascript自动切换选项卡效果
JQuery TabContainer
jQuery自动切换/点击切换选项卡效果代码
纯 CSS 选项卡的实现例子
jQuery自动切换/点击切换选项卡效果的小例子
纯CSS实现Tab页切换效果

[关闭]
最近更新
浏览排行
~ ~