js实现tab选项卡自动切换效果,当用户的鼠标经过选项时立即切换显示,可根据自己的需求来自定义。
<!DOCTYPE html 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=gb2312" /> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>js实现Tab选项卡自动切换特效_武鸣人</title> <style> OL LI { MARGIN: 8px } #con_wuming_ren { FONT-SIZE: 12px; MARGIN-RIGHT: 2px; WIDTH: 480px } #tags { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0px 0px; WIDTH: 450px; PADDING-TOP: 0px; HEIGHT: 23px } #tags LI { FLOAT: left; MARGIN-RIGHT: 1px; LIST-STYLE-TYPE: none; HEIGHT: 23px } #tags LI A { PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FLOAT: left; PADDING-BOTTOM: 0px; COLOR: #999; LINE-HEIGHT: 23px; PADDING-TOP: 0px; HEIGHT: 23px; TEXT-DECORATION: none } #tags LI.emptyTag { BACKGROUND: none transparent scroll repeat 0% 0%; WIDTH: 4px } #tags LI.selectTag { BACKGROUND-POSITION: left top; MARGIN-BOTTOM: -2px; POSITION: relative; HEIGHT: 25px } #tags LI.selectTag A { BACKGROUND-POSITION: right top; COLOR: #000; LINE-HEIGHT: 25px; HEIGHT: 25px } #tagContent { BORDER-RIGHT: #ddd 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: #ddd 1px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: #ddd 1px solid; PADDING-TOP: 1px; BORDER-BOTTOM: #ddd 1px solid; } .tagContent { PADDING-RIGHT: 2px; DISPLAY: none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; WIDTH: 480px; PADDING-TOP: 5px; HEIGHT: 210px } #tagContent DIV.selectTag { DISPLAY: block } #tagContent li { float: left; padding-left:1px; padding-bottom:7px; } #tagContent li span{ float: right; color:#ccc; font-size:10px; } </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div id="big" onmouseover="zhuan()" onmouseout="jixu()" class="column480" style="padding-left:3px;"> <DIV id="con_wuming_ren"> <UL id="tags"> <LI class="selectTag"><A onmouseover="selectTag('tagContent0',this)" href="javascript:void(0)">武鸣人一号</A> </LI> <LI><A onmouseover="selectTag('tagContent1',this)" href="javascript:void(0)">武鸣人二号</A></LI> <LI><A onmouseover="selectTag('tagContent2',this)" href="javascript:void(0)">武鸣人三号</A></LI> </UL> <DIV id="tagContent"> <DIV class="tagContent selectTag" id="tagContent0">武鸣人一号内容:<a href="https://www.wuming.ren">武鸣人</a>,各种信息免费发布,资源共享合作共赢!</DIV> <DIV class="tagContent" id="tagContent1">武鸣人二号内容:<a href="https://www.wuming.ren">武鸣人</a>,各种信息免费发布,资源共享合作共赢!</DIV> <DIV class="tagContent" id="tagContent2">武鸣人三号内容:<a href="https://www.wuming.ren">武鸣人</a>,各种信息免费发布,资源共享合作共赢!</DIV> </DIV> </DIV> <SCRIPT type="text/javascript"> var obig=document.getElementById("big"); function selectTag(showContent,selfObj){ var tag = document.getElementById("tags").getElementsByTagName("li"); var taglength = tag.length; for(i=0; i<taglength; i++){ tag[i].className = ""; } selfObj.parentNode.className = "selectTag"; for(i=0; j=document.getElementById("tagContent"+i); i++){ j.style.display = "none"; } document.getElementById(showContent).style.display = "block"; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var x=0; function scrollTag(){ var tags=document.getElementById("tags").getElementsByTagName("a"); if(x<2){x=x+1} else x=0; var tag = document.getElementById("tags").getElementsByTagName("li"); var taglength = tag.length; for(i=0; i<taglength; i++){ tag[i].className = ""; } tags[x].parentNode.className = "selectTag"; for(i=0; j=document.getElementById("tagContent"+i);i++){ j.style.display="none"; } document.getElementById("tagContent"+x).style.display="block"; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var scrolll=setInterval(scrollTag,2000); function zhuan(){ clearInterval(scrolll); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function jixu(){ scrolll=setInterval(scrollTag,2000); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) </SCRIPT> </div> </body> </html>
本文来自武鸣人网站,转载请注明出处