Home Web Front-end JS Tutorial Classic tab effect code implemented by JS CSS_javascript skills

Classic tab effect code implemented by JS CSS_javascript skills

May 16, 2016 pm 03:39 PM
css js tab Tab

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

This is a classic JavaScript CSS tab code, which is rewritten from the previous one. If you think it is good, please post it and share it.

The screenshot of the running effect is as follows:

The online demo address is as follows:

http://demo.jb51.net/js/2015/js-css-jd-tab-cha-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>
<title>选项卡</title>
<script type="text/javascript"> 
</script>
<style type="text/css"> 
 * { margin:0; padding:0; word-break:break-all; }
 h1, h2, h3, h4, h5, h6 { font-size:1em; }
 a { color:#333; text-decoration:none; }
 a:hover { text-decoration:underline; }
 ul, li { list-style:none; }
 fieldset, img { border:none; }
 #hotnews { width:260px; margin:1px; margin-left:auto; margin-right:auto;font-size:12px;}
 #hotnews_caption { width:260px; overflow:hidden; border-bottom:1px solid #FAFAFA; }
 #hotnews_caption ul { float:right; }
 #hotnews_caption ul li { float:left; border-left:1px solid #FFF; width:85px; line-height:25px; text-align:center; cursor:pointer;font-size:12px; }
 #hotnews_caption .normal { background:#E4E4E4; }
 #hotnews_caption .current{ background:#C2130E; color:#FFF; }
 #hotnews_content {}
 #hotnews_content .normal { display:none; }
 #hotnews_content .current { display:block; }
 #hotnews_content ul { padding:8px 0 0 5px; }
 #hotnews_content ul li a { font-size:12px;letter-spacing:1pt;line-height:14pt;}
</style>
<script type="text/javascript"> 
function secBoard(elementID,listName,n) {
 var elem = document.getElementById(elementID);
 var elemlist = elem.getElementsByTagName("li");
 for (var i=0; i<elemlist.length; i++) {
 elemlist[i].className = "normal";
 var m = i+1;
 document.getElementById(listName+"_"+m).className = "normal";
 }
 elemlist[n-1].className = "current";
 document.getElementById(listName+"_"+n).className = "current";
}
</script>
</head>
<body style=" margin-top:15px;">
<div id="hotnews">
 <div id="hotnews_caption">
 <ul>
  <li class="current" onmouseover="secBoard('hotnews_caption','list',1);">数字商务平台</li>
  <li class="normal" onmouseover="secBoard('hotnews_caption','list',2);">4GFax传真服务</li>
  <li class="normal" onmouseover="secBoard('hotnews_caption','list',3);">信息安全服务</li>
 </ul>
 </div>
 <div id="hotnews_content">
 <div class="current" id="list_1">
  <ul>
  <li>        <a href="products.aspx" target="_top">全真通数字商务平台是基于PKI体系,通过加密、签名、认证等手段,依据我国的数字签名法,在Internet上建立的一套安全、可信、具有法律效力的电子文件交换平台。为数字商务和数字政务服务!是我国数字签名法最有价值的推广应用产品!</a></li>  
  </ul> 
 </div>
 <div class="normal" id="list_2">
  <ul>
  <li>        <a href="products.aspx" target="_top">基于数字中继和模拟线路并结合互联网形成了面向企业和政府用户传真收发服务的传真服务系统,集传真的管理和收发于一体,为企业和政府提供智能传真解决方案。</a></li>
  </ul>
 </div>
 <div class="normal" id="list_3">
  <ul>
  <li>        <a href="products.aspx" target="_top">基于PKI体系,结合数字证书的应用为企业和政府提供的身份认证、加密、签名的技术解决方案,实现用户身份的可鉴别性、通道的安全性、文件的安全性、主机的安全性等系列产品。</a></li>
  </ul>
 </div>
 </div>
</div>
</body>
</html>
Copy after login

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

Statement of this Website
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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

See all articles