A popular Tab switching effect code on the internet, mainly used for navigation.

Source: Internet
Author: User

Popular onlineTabThe code for switching results is mainly used for navigation.

<Div class ="Tab">
<Div id = "tabsk">
<Ul id = "menu4">
<Li onclick = "settab (4, 0) "Class =" hover "> <a Title =" Latest Update "> <span> latest update </span> </a> </LI>
<Li onclick = "settab (4, 1)"> <a Title = "Enterprise News"> <span> enterprise news </span> </a> </LI>
<Li onclick = "settab (4, 2)"> <a Title = "industry news"> <span> industry news </span> </a> </LI>
<Li onclick = "settab (4, 3)"> <a Title = ""> <span> </span> </a> </LI>
<Li onclick = "settab (4, 4)"> <a Title = "Tech News"> <span> tech news </span> </a> </LI>
</Ul>
</Div>
<Div class ="Tab2 "id =" main4 ">
<Ul class = "Block"> </ul>
<Ul> </ul>
<Ul> </ul>
<Ul> </ul>
<Ul> </ul>
</Div>
</Div>

CSS:

# Tabsk {
Float: left;
Width: 100%;
Line-Height: normal;
Border-bottom: 1px solid # 54545c;
}
# Tabsk ul {
Margin: 0;
Padding: 10px 10px 0 10px;
List-style: none;
}
# Tabsk Li {
Display: inline;
Margin: 0;
Padding: 0;
Cursor: pointer;
}
# Tabsk {
Float: left;
Background: URL ("image/Tableftk.gif") No-repeat left top;
Margin: 0;
Padding: 0 0 0 4px;
Text-Decoration: none;
}
# Tabsk a span {
Float: left;
Display: block;
Background: URL ("image/tabrightk.gif") No-repeat right top;
Padding: 8px 16px 4px 6px;
Color: # FFF;
}
# Tabsk a span {float: none ;}
/* End IE5-Mac hack */
# Tabsk A: hover span {
Cursor: pointer;
Color: # FFF;
Background-position: 100%-42px;
}
# Tabsk A: hover {
Background-position: 0%-42px;
Cursor: pointer;
}
# Tabsk. Hover
{
Background-position: 0%-42px;
}
# Tabsk. Hover Span
{
Background-position: 100%-42px;
}
.Tab2 uL
{
Display: none;
List-style-type: none;
Height: 560px;
}
.Tab2 uL Li
{
Text-align: left;
Line-Height: 20px;
Text-indent: 1em;
}
.Tab2. Block
{
Display: block;
}

JS:

<Script language = "JavaScript"> <! --
Function settab (m, n ){
VaR TLI = Document. getelementbyid ("menu" + M). getelementsbytagname ("Li ");
VaR MLI = Document. getelementbyid ("Main" + M). getelementsbytagname ("Ul ");
For (I = 0; I <TLI. length; I ++ ){
TLI [I]. classname = I = n? "Hover ":"";
MLI [I]. style. Display = I = n? "Block": "NONE ";
}
}
// --> </SCRIPT>

And the two images used:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.