Html+css+js Implementing TAB switching

Source: Internet
Author: User

CSS section:

#Tab {
margin:0 Auto;
width:640px;
Border:none;
Position:absolute;
Z-index:9;
margin-left:320px;
_margin-left:0px;
padding-top:180px;
}
. Menubox {
height:26px;
border-bottom:2px solid #64B8E4;
Background: #none;
}
. Menubox ul {
List-style:none;
margin:0;
padding:0;
Position:absolute;
}
. Menubox ul Li {
Float:left;
Background: #64B8E4;
line-height:26px;
Display:block;
Cursor:pointer;
width:65px;
Text-align:center;
Color: #fff;
Font-weight:bold;
border-top:1px solid #64B8E4;
border-left:1px solid #64B8E4;
border-right:1px solid #64B8E4;
border-top-left-radius:4px;
border-top-right-radius:4px;
}
. Menubox ul Li.hover {
Background: #fff;
border-bottom:1px solid #fff;
Color: #147AB8;
}
. Contentbox {
Clear:both;
margin-top:0px;
Border-top:none;
height:10px;
padding-top:8px;
}
. Contentbox ul {
List-style:none;
margin:7px;
padding:0;
}
. Contentbox ul Li {
line-height:24px;
border-bottom:1px dotted #ccc;
}

JS section:

<script type= "Text/javascript" >
function Settab (name,cursel,n) {
for (i=1;i<=n;i++) {
var Menu=document.getelementbyid (name+i);
var Con=document.getelementbyid ("Con_" +name+ "_" +i);
Menu.classname=i==cursel? " Hover ":" ";
Con.style.display=i==cursel? " Block ":" None ";
}
}
</script>

HTML section:

<div id= "tab" >
<div class= "Menubox" >
<ul>
<li id= "menu1" onmouseover= "settab (' menu ',") "class=" hover "> Department Dynamics </li>
<li id= "menu2" onmouseover= "settab (' menu ', 2,3)" > Institutions-Tray </li>
<li id= "Menu3" onmouseover= "settab (' menu ', 3,3)" > Agency posts </li>
</ul>
</div>
<div class= "Contentbox" >
<div id= "con_menu_1" class= "hover" >
<ul>
<li><a href= "#" >1213</a></li>
<li><a href= "#" >12312123</a></li>
<li><a href= "#" >123123123</a></li>
<li><a href= "#" >3123123213</a></li>
<li><a href= "#" >1231232131</a></li>
<li><a href= "#" >123123123123</a></li>
<li><a href= "#" >3232323</a></li>
<li><a href= "#" >23232323</a></li>
</ul>
</div>
<div id= "con_menu_2" style= "Display:none" >
<ul>
<li><a href= "#" >2312312312</a></li>
<li><a href= "#" >123123123</a></li>
<li><a href= "#" >1231231231</a></li>
<li><a href= "#" >123123123123</a></li>
<li><a href= "#" >123123123123</a></li>
<li><a href= "#" >12312312312</a></li>
<li><a href= "#" >123123123</a></li>
<li><a href= "#" >123123123123123</a></li>
</ul>
</div>
<div id= "Con_menu_3" style= "Display:none" >
<ul>
<li><a href= "#" >123</a></li>
<li><a href= "#" >12323213</a></li>
<li><a href= "#" >323123123</a></li>
<li><a href= "#" >123123123</a></li>
<li><a href= "#" >123123</a></li>
<li><a href= "#" >123123</a></li>
<li><a href= "#" >1231231</a></li>
<li><a href= "#" >123123123</a></li>
</ul>
</div>
</div>
</div>

Html+css+js Implementing TAB switching

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.