JS实现黑色风格的网页TAB选项卡效果代码_Javascript教程-查字典教程网
JS实现黑色风格的网页TAB选项卡效果代码
JS实现黑色风格的网页TAB选项卡效果代码
发布时间:2016-12-30 来源:查字典编辑
摘要:本文实例讲述了JS实现黑色风格的网页TAB选项卡效果代码。分享给大家供大家参考。具体如下:这是一款网页TAB选项卡JS代码,黑色超酷的风格,...

本文实例讲述了JS实现黑色风格的网页TAB选项卡效果代码。分享给大家供大家参考。具体如下:

这是一款网页TAB选项卡JS代码,黑色超酷的风格,看了后你会喜欢的,很熟悉很经典的风格,似曾相识的感觉,希望大家喜欢。

运行效果截图如下:

在线演示地址如下:

http://demo.jb51.net/js/2015/js-black-style-web-tab-demo/

具体代码如下:

<!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> <script type="text/jscript"> 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"; con.style.display=i==cursel"; } } </script> <style type="text/css"> *{ margin:0px; padding:0px; list-style:none; } .main{ width:306px; height:299px; float:left; margin:300px; display:inline; background:#000; padding:3px; } .main .menu{ width:306px; height:31px; overflow:hidden; float:left; } .main .menu span{ width:60px; height:30px; line-height:30px; overflow:hidden; text-align:center; float:left; margin:1px 0 0 1px; background:#333; color:#BCBCBC; font-weight:bold; cursor:pointer; font-size:12px; } .main .menu .hover{ background:#666; color:#FFF; } .main .content{ width:304px; height:266px; overflow:hidden; float:left; margin:1px; margin-top:0px; display:inline; background:#333333; } .main .content div{ width:304px; height:266px; line-height:266px; text-align:center; color:#FFFFFF; font-weight:bold; background:#666; } </style> </head> <body> <div> <div> <span id="one1">菜单一</span> <span id="one2">菜单二</span> <span id="one3">菜单三</span> <span id="one4">菜单四</span> <span id="one5">菜单五</span> </div> <div> <div id="con_one_1">内容一</div> <div id="con_one_2">内容二</div> <div id="con_one_3">内容三</div> <div id="con_one_4">内容四</div> <div id="con_one_5">内容五</div> </div> </div> </body> </html>

希望本文所述对大家的JavaScript程序设计有所帮助。

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类