


JS method to realize tab linkage between horizontal and vertical tabs_javascript skills
The example in this article describes the method of realizing Tab linkage between horizontal and vertical tabs using JS. Share it with everyone for your reference. The details are as follows:
This is a horizontal and vertical linkage tab. The content of the card is the same, but there is an additional operation method. When one tab is clicked, the other tab will also indicate the corresponding option. The card position, that is, the functions of both are the same, which is a very clever layout method.
The screenshot of the running effect is as follows:
The online demo address is as follows:
http://demo.jb51.net/js/2015/js-hx-sx-tab-ld-demo/
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=utf-8" /> <title>选项卡Tab联动</title> <style type="text/css"> body{text-align:center;margin:0;padding:0;font-size:12px;} div,form,img,ul,ol,li,dl,dt,dd{margin:0;padding:0;border:0;} h1,h2,h3,h4,h5,h6,p,table,td{margin:0;padding:0;font-size:12px;} li{list-style:none;} #layout{width:500px;margin:10px auto;} #tabnav{width:80px;float:left;} #tabnav li{float:left;width:70px;height:23px;line-height:23px;cursor:pointer;border:1px solid #ccc;margin:2px 0 0 0;display:inline;color:#333;} #tabnav li.current{color:#f60;font-weight:bold;} #tab{width:400px;height:235px;float:right;} #tab ul{width:400px;height:24px;} #tab li{float:left;width:70px;height:23px;line-height:23px;cursor:pointer;border:1px solid #ccc;margin:0 1px 0 0;display:inline;background:#333;color:#fff;} #tab li.current{background:#f60;font-weight:bold;} #tab .tabcon{float:left;width:398px;height:208px;display:none;border:1px solid #ccc;} #tab .block{display:block;} </style> </head> <body> <div id="layout"> <ul id="tabnav"> <li onclick="go_to(1);" class="current">最新精华帖</li> <li onclick="go_to(2);">最新帖子</li> <li onclick="go_to(3);">最旧帖子</li> <li onclick="go_to(4);">新最帖子</li> <li onclick="go_to(5);">旧最帖子</li> </ul> <div id="tab"> <ul id="tabnav02"> <li onclick="go_to(1);" class="current">最新精华帖</li> <li onclick="go_to(2);">最新帖子</li> <li onclick="go_to(3);">最旧帖子</li> <li onclick="go_to(4);">新最帖子</li> <li onclick="go_to(5);">旧最帖子</li> </ul> <div id="tabcon_1" class="tabcon block"> 1 </div> <div id="tabcon_2" class="tabcon"> 2 </div> <div id="tabcon_3" class="tabcon"> 3 </div> <div id="tabcon_4" class="tabcon"> 4 </div> <div id="tabcon_5" class="tabcon"> 5 </div> <script type="text/javascript"> <!-- var h=document.getElementById("tabnav").getElementsByTagName("li"); var d=document.getElementById("tabnav02").getElementsByTagName("li"); function go_to(s){ for(var i=1;i<=h.length;i++){ if(s==i){ h[i-1].className="current"; d[i-1].className="current"; document.getElementById("tabcon_"+i).className="tabcon block"; } else{ h[i-1].className=""; d[i-1].className=""; document.getElementById("tabcon_"+i).className="tabcon"; } } } //--> </script> </div> </div> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to use JS and Baidu Map to implement map pan function Baidu Map is a widely used map service platform, which is often used in web development to display geographical information, positioning and other functions. This article will introduce how to use JS and Baidu Map API to implement the map pan function, and provide specific code examples. 1. Preparation Before using Baidu Map API, you first need to apply for a developer account on Baidu Map Open Platform (http://lbsyun.baidu.com/) and create an application. Creation completed

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

Journey through the vastness and set foot on the journey to the west! Today, Zhengtu IP officially announced that it will launch a cross-border cooperation with CCTV animation "Journey to the West" to jointly create a cultural feast that combines tradition and innovation! This cooperation not only marks the in-depth cooperation between the two major domestic classic brands, but also demonstrates the unremitting efforts and persistence of the Zhengtu series on the road of promoting Chinese traditional culture. Since its birth, the Zhengtu series has been loved by players for its profound cultural heritage and diversified gameplay. In terms of cultural inheritance, the Zhengtu series has always maintained respect and love for traditional Chinese culture, and skillfully integrated traditional cultural elements into the game, bringing more fun and inspiration to players. The CCTV animation "Journey to the West" is a classic that has accompanied the growth of generations.

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

Today I was doing an experiment on centOS and found that the customary tab key completion method used under Ubuntu could not be used. So I was very curious. After searching for information and testing it myself, I recorded the possible solutions as follows: 1) First, you need to Run the following command in the terminal: #yuminstallbash-completion//You can also use wildcard installation: yuminstallbash-c* or you can install some initialization package groups yum-ygroupinstallBaseCompatibilitylibrariesDebuggingToolsDial-upNetworkingsupppo

How to use JS and Baidu Maps to implement the map heat map function Introduction: With the rapid development of the Internet and mobile devices, maps have become a common application scenario. As a visual display method, heat maps can help us understand the distribution of data more intuitively. This article will introduce how to use JS and Baidu Map API to implement the map heat map function, and provide specific code examples. Preparation work: Before starting, you need to prepare the following items: a Baidu developer account, create an application, and obtain the corresponding AP

With the rapid development of Internet finance, stock investment has become the choice of more and more people. In stock trading, candle charts are a commonly used technical analysis method. It can show the changing trend of stock prices and help investors make more accurate decisions. This article will introduce the development skills of PHP and JS, lead readers to understand how to draw stock candle charts, and provide specific code examples. 1. Understanding Stock Candle Charts Before introducing how to draw stock candle charts, we first need to understand what a candle chart is. Candlestick charts were developed by the Japanese
