search
HomeWeb Front-endJS TutorialClassic label switching effect code implemented by JS DIV CSS_javascript skills

The example in this article describes the classic label switching effect code implemented by JS DIV CSS. Share it with everyone for your reference. The details are as follows:

Here is a demonstration of the label switching effect code implemented by JS DIV CSS. In layman's terms, it is the effect of sliding doors. It is a very good example. I hope it will be helpful for you to learn JS CSS layout.

The screenshot of the running effect is as follows:

The online demo address is as follows:

http://demo.jb51.net/js/2015/js-div-css-bq-cha-tab-style-codes/

The specific code is as follows:

<!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" />
<title>DIV CSS布局实例:CSS标签切换代码</title>
<style type="text/css"> 
* {list-style-type:none; font-size:12px; text-decoration:none; margin:0; padding:0;}
a {behavior:url(xuxian.htc)}
.woaicss {width:438px; height:300px; overflow:hidden; margin:50px auto;}
.woaicss_title {width:438px; height:30px; background:#fff url(images/btn_bg.png) no-repeat; overflow:hidden;}
.woaicss_title li {display:block; float:left; margin:0 2px 0 0; display:inline; text-align:center;}
.woaicss_title li a {display:block; width:90px; heigth:30px; line-height:34px; color:#fff;}
.woaicss_title li a:hover {color:#f0f0f0; text-decoration:underline;}
.woaicss_title_bg1 {background-position:0 0;}
.woaicss_title_bg2 {background-position:0 -30px;}
.woaicss_title_bg3 {background-position:0 -60px;}
.woaicss_title_bg4 {background-position:0 -90px;}
.woaicss_con {display:block; width:438px; height:270px; background:url(images/con_bg.png) no-repeat 0 0; overflow:hidden;}
.woaicss_con ul {width:418px; height:250px; margin:12px auto;}
.woaicss_con li {width:418px; line-height:30px; margin:0 auto; white-space:nowrap; text-overflow:ellipsis; overflow: hidden;}
.woaicss_con li a {color:#03c;}
.woaicss_con li a:hover {color:#069; text-decoration:underline;}
.woaicss_copy {width:438px; margin:10px auto; text-align:center;}
.woaicss_copy a {color:#f00;}
</style>
</head>
<body>
<div class="woaicss">
<script language="javascript"> 
 function woaicssq(num){
 for(var id = 1;id<=4;id++)
 {
 var MrJin="woaicss_con"+id;
 if(id==num)
 document.getElementById(MrJin).style.display="block";
 else
 document.getElementById(MrJin).style.display="none";
 }
 if(num==1) 
 document.getElementById("woaicsstitle").className="woaicss_title woaicss_title_bg1";
 if(num==2)
 document.getElementById("woaicsstitle").className="woaicss_title woaicss_title_bg2";
 if(num==3)
 document.getElementById("woaicsstitle").className="woaicss_title woaicss_title_bg3";
 if(num==4)
 document.getElementById("woaicsstitle").className="woaicss_title woaicss_title_bg4";
 }
</script>
 <ul class="woaicss_title woaicss_title_bg1" id="woaicsstitle">
  <li><a href="#" target="_blank" onmouseover="javascript:woaicssq(1)">ExtJS</a></li>
  <li><a href="#" target="_blank" onmouseover="javascript:woaicssq(2)">Div教程</a></li>
  <li><a href="#" target="_blank" onmouseover="javascript:woaicssq(3)">CSS布局实例</a></li>
  <li><a href="#" target="_blank" onmouseover="javascript:woaicssq(4)">WEB标准化</a></li>
 </ul>
 <div class="woaicss_con" id="woaicss_con1" style="display:block;">
   <ul>
    <li>·<a href="#" title="">Web Developer插件教程 CSS网页布局辅助设计利器!详细图文讲解!</a></li>
    <li>·<a href="#" title="">CSS Templates 频道4月5日更新 增加模板22套</a></li>
    <li>·<a href="#" title="">XHTML与CSS入门经典 从零开始系列教程!</a></li>
    <li>·<a href="#" title="">DIV+CSS布局入门示例(目录)</a></li>
    <li>·<a href="#" title="">CSS基础教程17篇 [翻译Htmldog]</a></li>
    <li>·<a href="#" title="">DIV CSS布局实例:用css网站布局之十步实录!(目录) </a></li>
    <li>·<a href="#" title="">WEB2.0标准教程 循序渐进十二天的基础学习!</a></li>
    <li>·<a href="#" title="">Div+CSS 网页布局 教程!</a></li>
   </ul>
 </div>
 <div class="woaicss_con" id="woaicss_con2" style="display:none;">
   <ul>
    <li>·<a href="#" title="">DIV+CSS的XHTML代码结构浅谈 - 不要真DIV+CSS了</a></li>
    <li>·<a href="#" title="">Div CSS教程:letter-spacing与word-spacing属性详解</a></li>
    <li>·<a href="#" title="">margin外边距属性在inline内联元素中应用的测试!</a></li>
    <li>·<a href="#" title="">Div CSS教程:block element与inline element元素详解 </a></li>
    <li>·<a href="#" title="">DIV CSS实例教程:一款清新风格的CSS新闻列表制作</a></li>
    <li>·<a href="#" title="">DIV CSS布局中如何组织样式表以便于简化、维护</a></li>
    <li>·<a href="#" title="">DIV CSS编码中容易犯的一些错误 DIV CSS编码中容易犯的一些错误</a></li>
    <li>·<a href="#" title="">如何将XHTML+CSS页面转换为打印机页面</a></li>
   </ul>
 </div>
 <div class="woaicss_con" id="woaicss_con3" style="display:none;">
   <ul>
    <li>·<a href="#" title="">IE6、IE7绝对定位与链接 问题研究</a></li>
    <li>·<a href="#" title="">CSS实例:无懈可击的CSS圆角技术!</a></li>
    <li>·<a href="#" title="">CSS布局教程:DIV+CSS三列式布局的实现方法</a></li>
    <li>·<a href="#" title="">CSS基础实例:CSS实现带背景图片的文字链接的方法</a></li>
    <li>·<a href="#" title="">Div+CSS实例:如何用CSS实现背景半透明效果</a></li>
    <li>·<a href="#" title="">CSS实例:list-style-type在IE与FF中奇怪的现象解析</a></li>
    <li>·<a href="#" title="">Div CSS布局关于分辨率与100%自适应问题的探讨!</a></li>
    <li>·<a href="#" title="">CSS实例:如何让无空格的长字符在IE和FF下面实现自动换行?</a></li>
   </ul>
 </div>
 <div class="woaicss_con" id="woaicss_con4" style="display:none;">
   <ul>
    <li>·<a href="#" title="">CSS实用案例集(第2版) - CSS Cookbook</a></li>
    <li>·<a href="#" title="">CSS禅意花园 读后感</a></li>
    <li>·<a href="#" title="">CSS实战手册 公开发行 强烈推荐!2007年第17届Jolt 生产效率大奖</a></li>
    <li>·<a href="#" title="">CSSer:你该如何发展,如何学习进步?</a></li>
    <li>·<a href="#" title="">The ultimate webdesign usability checklist</a></li>
    <li>·<a href="#" title="">Adobe Dreamweaver CS3 新功能简介</a></li>
    <li>·<a href="#" title="">Web Standards与Web2.0应有所区别!</a></li>
    <li>·<a href="#" title="">CSS教程:是什么使得CSS改善了WEB网站的可访问性</a></li>
   </ul>
 </div>
</div>
</body>
</html>

I hope this article will be helpful to everyone’s JavaScript programming.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
C   and JavaScript: The Connection ExplainedC and JavaScript: The Connection ExplainedApr 23, 2025 am 12:07 AM

C and JavaScript achieve interoperability through WebAssembly. 1) C code is compiled into WebAssembly module and introduced into JavaScript environment to enhance computing power. 2) In game development, C handles physics engines and graphics rendering, and JavaScript is responsible for game logic and user interface.

From Websites to Apps: The Diverse Applications of JavaScriptFrom Websites to Apps: The Diverse Applications of JavaScriptApr 22, 2025 am 12:02 AM

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

Python vs. JavaScript: Use Cases and Applications ComparedPython vs. JavaScript: Use Cases and Applications ComparedApr 21, 2025 am 12:01 AM

Python is more suitable for data science and automation, while JavaScript is more suitable for front-end and full-stack development. 1. Python performs well in data science and machine learning, using libraries such as NumPy and Pandas for data processing and modeling. 2. Python is concise and efficient in automation and scripting. 3. JavaScript is indispensable in front-end development and is used to build dynamic web pages and single-page applications. 4. JavaScript plays a role in back-end development through Node.js and supports full-stack development.

The Role of C/C   in JavaScript Interpreters and CompilersThe Role of C/C in JavaScript Interpreters and CompilersApr 20, 2025 am 12:01 AM

C and C play a vital role in the JavaScript engine, mainly used to implement interpreters and JIT compilers. 1) C is used to parse JavaScript source code and generate an abstract syntax tree. 2) C is responsible for generating and executing bytecode. 3) C implements the JIT compiler, optimizes and compiles hot-spot code at runtime, and significantly improves the execution efficiency of JavaScript.

JavaScript in Action: Real-World Examples and ProjectsJavaScript in Action: Real-World Examples and ProjectsApr 19, 2025 am 12:13 AM

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

JavaScript and the Web: Core Functionality and Use CasesJavaScript and the Web: Core Functionality and Use CasesApr 18, 2025 am 12:19 AM

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

Understanding the JavaScript Engine: Implementation DetailsUnderstanding the JavaScript Engine: Implementation DetailsApr 17, 2025 am 12:05 AM

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version