Home > Web Front-end > JS Tutorial > JS realizes light blue simple vertical Tab click switching effect_javascript skills

JS realizes light blue simple vertical Tab click switching effect_javascript skills

WBOY
Release: 2016-05-16 15:37:21
Original
1274 people have browsed it

The example in this article describes the implementation of light blue simple vertical Tab click switching effect using JS. Share it with everyone for your reference. The details are as follows:

Here we introduce a light blue vertical simple Tab. Tab is a style that many people like.

The screenshot of the running effect is as follows:

The online demo address is as follows:

http://demo.jb51.net/js/2015/js-blue-v-tab-cha-style-menu-codes/

The specific code is as follows:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<title>简洁Tab</title>
<style type="text/css">
<!--
body{ padding:0;font:12px "宋体"; }
#lib_Tab1_sx{width:500px;margin:0px;padding:0px;margin-bottom:15px; overflow:hidden;}
.lib_tabborder_sx{border:1px solid #95C9E1;}
.lib_Menubox_sx {line-height:28px;position:relative; float:left; width:130px; height:240px;border-right:1px solid #95C9E1;}
.lib_Menubox_sx ul{margin:0px;padding:0px;list-style:none; position:absolute; top:15px; left:5px; margin-left:10px; height:25px;text-align:center;}
.lib_Menubox_sx li{display:block;cursor:pointer;width:114px;color:#949694;font-weight:bold; margin-bottom:5px;height:25px;line-height:25px; background-color:#E4F2FD}
.lib_Menubox_sx li.hover{padding:0px;background:#fff;width:116px;border:1px solid #95C9E1; border-right:0;
color:#739242;height:25px;line-height:25px;}
.lib_Contentbox_sx{margin-top:0px; border-top:none;padding:20px; border-left:0; margin-left:130px;}
-->
</style>
<script>
<!--
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&#63;"hover":"";
 con.style.display=i==cursel&#63;"block":"none";
 }
}
//-->
</script>
</head>
<body>
<div id="lib_Tab1_sx" class="lib_tabborder_sx">
<div class="lib_Menubox_sx ">
<ul>
  <li id="one1" onclick="setTab('one',1,5)" class="hover">脚本代码</li>
  <li id="one2" onclick="setTab('one',2,5)" >ASP类</li>
  <li id="one3" onclick="setTab('one',3,5)">PHP类</li>  
  <li id="one4" onclick="setTab('one',4,5)">JSP类</li>
  <li id="one5" onclick="setTab('one',5,5)">.NET类</li>
</ul>
</div>
 <div class="lib_Contentbox_sx "> 
  <div id="con_one_1" >脚本列表</div>
  <div id="con_one_2" style="display:none">ASP类更新</div>
  <div id="con_one_3" style="display:none">PHP类更新</div>
  <div id="con_one_4" style="display:none">JSP类更新</div> 
  <div id="con_one_5" style="display:none">ASP.NET类更新</div> 
 </div>
</div>
</body>
</html>

Copy after login

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

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template