网站推荐、资源下载等 | 个人网站

jsp选项卡导航实现——模板

效果

刚进来页面的样子

在第二个选项卡上方时

点击后

离开

同样第三个

点击

移走鼠标

代码

  1 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  2 <head>
  3     <title>选项卡式导航</title>
  4     <style type="text/css">
  5         <!--
  6         * {
  7             margin: 0; padding:0
  8         }
  9         body {
 10             margin-top: 10px;
 11             margin-right: 10%;
 12             margin-bottom: 10px;
 13             margin-left: 10%;
 14             text-align: center;
 15             height: auto;
 16             width: auto;
 17             background-color: #666666;
 18             font-size: 12px;
 19             color: #000000;
 20         }
 21         #container {
 22             text-align: left;
 23             width: 760px;
 24             height: 400px;
 25             padding: 20px;
 26         }
 27         #container #title {
 28             height: 28px;
 29         }
 30         #container #title li {
 31             float: left;
 32             list-style-type: none;
 33             height: 28px;
 34             line-height: 28px;
 35             text-align: center;
 36             margin-right: 1px;
 37         }
 38         #container #title ul {
 39             height: 28px;
 40         }
 41         #container #title a {
 42             text-decoration: none;
 43             color: #000000;
 44             display: block;
 45             width: auto;
 46         }
 47         #container #title a span{
 48             display: block;
 49             padding: 0 15px 0 15px;
 50         }
 51         #container #title #tag1 a:hover {
 52             text-decoration: none;
 53             display: block;
 54             width: auto;
 55         }
 56         #container #title #tag1 a:hover span{
 57             display: block;
 58             background-color: dodgerblue;
 59             padding: 0 15px 0 15px;
 60         }
 61         #container #title #tag2 a:hover {
 62             text-decoration: none;
 63             display: block;
 64             width: auto;
 65         }
 66         #container #title #tag2 a:hover span{
 67             background-color: dodgerblue;
 68             display: block;
 69             padding: 0 15px 0 15px;
 70         }
 71         #container #title #tag3 a:hover {
 72             text-decoration: none;
 73             display: block;
 74             width: auto;
 75         }
 76         #container #title #tag3 a:hover span{
 77             background-color: dodgerblue;
 78             display: block;
 79             padding: 0 15px 0 15px;
 80         }
 81         #container #title #tag4 a:hover {
 82             text-decoration: none;
 83             display: block;
 84             width: auto;
 85         }
 86         #container #title #tag4 a:hover span{
 87             background-color: dodgerblue;
 88             display: block;
 89             padding: 0 15px 0 15px;
 90         }
 91         #container #title #tag5 a:hover {
 92             text-decoration: none;
 93             display: block;
 94             width: auto;
 95         }
 96         #container #title #tag5 a:hover span{
 97             background-color: dodgerblue;
 98             display: block;
 99             padding: 0 15px 0 15px;
100         }
101         #container #title .selectli1 {
102             text-decoration: none;
103             color: #ffffff;
104             display: block;
105             width: auto;
106         }
107         #container #title a .selectspan1 {
108             display: block;
109             padding: 0 15px 0 15px;
110         }
111         #container #title .selectli2 {
112             text-decoration: none;
113             color: #ffffff;
114             display: block;
115             width: auto;
116         }
117         #container #title a .selectspan2 {
118             display: block;
119             padding: 0 15px 0 15px;
120         }
121         #container #title .selectli3 {
122             text-decoration: none;
123             color: #ffffff;
124             display: block;
125             width: auto;
126         }
127         #container #title a .selectspan3 {
128             display: block;
129             padding: 0 15px 0 15px;
130         }
131         #container #title .selectli4 {
132             text-decoration: none;
133             color: #ffffff;
134             display: block;
135             width: auto;
136         }
137         #container #title a .selectspan4 {
138             display: block;
139             padding: 0 15px 0 15px;
140         }
141         #container #title .selectli5 {
142             text-decoration: none;
143             color: #ffffff;
144             display: block;
145             width: auto;
146         }
147         #container #title a .selectspan5 {
148             display: block;
149             padding: 0 15px 0 15px;
150         }
151         #container #content ul {margin: 10px;}
152         #container #content li {margin: 5px; }
153         #container #content li img {margin: 5px;display:block;}
154         #container #content {
155             height: 300px;
156             padding: 10px;
157         }
158         .content1 {
159             border-top-width: 3px;
160             border-right-width: 1px;
161             border-bottom-width: 1px;
162             border-left-width: 1px;
163             border-top-style: solid;
164             border-right-style: solid;
165             border-bottom-style: solid;
166             border-left-style: solid;
167             border-top-color: #3A81C8;
168             border-right-color: #3A81C8;
169             border-bottom-color: #3A81C8;
170             border-left-color: #3A81C8;
171             background-color: #DFEBF7;
172         }
173         .content2 {
174             border-top-width: 3px;
175             border-right-width: 1px;
176             border-bottom-width: 1px;
177             border-left-width: 1px;
178             border-top-style: solid;
179             border-right-style: solid;
180             border-bottom-style: solid;
181             border-left-style: solid;
182             border-top-color: #ff950b;
183             border-right-color: #ff950b;
184             border-bottom-color: #ff950b;
185             border-left-color: #ff950b;
186             background-color: #FFECD2;
187         }
188         .content3 {
189             height: 300px;
190             padding: 10px;
191             border-top-width: 3px;
192             border-right-width: 1px;
193             border-bottom-width: 1px;
194             border-left-width: 1px;
195             border-top-style: solid;
196             border-right-style: solid;
197             border-bottom-style: solid;
198             border-left-style: solid;
199             border-top-color: #FE74B8;
200             border-right-color: #FE74B8;
201             border-bottom-color: #FE74B8;
202             border-left-color: #FE74B8;
203             background-color: #FFECF5;
204         }
205         .content4 {
206             height: 300px;
207             padding: 10px;
208             border-top-width: 3px;
209             border-right-width: 1px;
210             border-bottom-width: 1px;
211             border-left-width: 1px;
212             border-top-style: solid;
213             border-right-style: solid;
214             border-bottom-style: solid;
215             border-left-style: solid;
216             border-top-color: #00988B;
217             border-right-color: #00988B;
218             border-bottom-color: #00988B;
219             border-left-color: #00988B;
220             background-color: #E8FFFD;
221         }
222         .content5 {
223             height: 300px;
224             padding: 10px;
225             border-top-width: 3px;
226             border-right-width: 1px;
227             border-bottom-width: 1px;
228             border-left-width: 1px;
229             border-top-style: solid;
230             border-right-style: solid;
231             border-bottom-style: solid;
232             border-left-style: solid;
233             border-top-color: #A8BC1F;
234             border-right-color: #A8BC1F;
235             border-bottom-color: #A8BC1F;
236             border-left-color: #A8BC1F;
237             background-color: #F7FAE2;
238         }
239         .hidecontent {display:none;}
240         -->
241     </style>
242     <script language="javascript">
243         function switchTag(tag,content)
244         {
245 //    alert(tag);
246 //    alert(content);
247             for(i=1; i < 6; i++)
248             {
249                 if ("tag"+i==tag)
250                 {
251                     document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;
252                     document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")
253                         [0].className="selectspan"+i;
254                 }else{
255                     document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";
256                     document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")
257                         [0].className="";
258                 }
259                 if ("content"+i==content)
260                 {
261                     document.getElementById(content).className="";
262                 }else{
263                     document.getElementById("content"+i).className="hidecontent";
264                 }
265                 document.getElementById("content").className=content;
266             }
267         }
268     </script>
269 </head>
270 <body>
271 <div id="container">
272     <div id="title">
273         <ul>
274             <li id="tag1"><a href="#" onclick="switchTag('tag1','content1');this.blur();" class="selectli1"><span
275                     class="selectspan1">首页</span></a></li>
276             <li id="tag2"><a href="#" onclick="switchTag('tag2','content2');this.blur();"><span>下载中心</span></a></li>
277             <li id="tag3"><a href="#" onclick="switchTag('tag3','content3');this.blur();"><span>产品介绍</span></a></li>
278             <li id="tag4"><a href="#" onclick="switchTag('tag4','content4');this.blur();"><span>会员注册与登录</span></a></li>
279             <li id="tag5"><a href="#" onclick="switchTag('tag5','content5');this.blur();"><span>联系我们</span></a></li>
280         </ul>
281     </div>
282     <div id="content" class="content1">
283         <div id="content1" >1、根据字数自适应项目长度</div>
284         <div id="content2" class="hidecontent">2、不同的项目使用不同的颜色来区分</div>
285         <div id="content3" class="hidecontent">3、这回需要使用到js了,呵呵</div>
286         <div id="content4" class="hidecontent">4、背景图片只需要两个图片文件就足够,减少服务器负担</div>
287         <div id="content5" class="hidecontent">5、这是使用到的两个图片</div>
288     </div>
289 </div>
290 </body>
291 </html>

 

posted @ 2019-01-19 10:09  xiaostudy  阅读(3719)  评论(0编辑  收藏  举报
网站推荐
[理工最爱]小时百科 |  GitHub |  Gitee |  开源中国社区 |  牛客网 |  不学网论坛 |  r2coding |  冷熊简历 |  爱盘 |  零散坑 |  bootstrap中文网 |  vue.js官网教程 |  源码分享站 |  maven仓库 |  楼教主网站 |  廖雪峰网站 |  w3cschool |  在线API |  代码在线运行 |  [不学网]代码在线运行 |  JS在线运行 |  PHP中文网 |  深度开源eclipse插件 |  文字在线加密解密 |  菜鸟教程 |  慕课网 |  千图网 |  手册网 |  素材兔 |  盘多多 |  悦书PDF |  sumatra PDF |  calibre PDF |  Snipaste截图 |  shareX截图 |  vlc-media-player播放器 |  MCMusic player |  IDM下载器 |  格式工厂 |  插件网 |  谷歌浏览器插件 |  Crx搜搜 |  懒人在线计算器 |  leetcode算法题库 |  layer官网 |  layui官网 |  formSelects官网 |  Fly社区 |  程序员客栈 |  融云 |  华为云 |  阿里云 |  ztree官网API |  teamviewer官网 |  sonarlint官网 |  editormd |  pcmark10官网 |  crx4chrome官网 |  apipost官网 |  花生壳官网 |  serv-u官网 |  杀毒eset官网 |  分流抢票bypass官网 |  懒猴子CG代码生成器官网 |  IT猿网 |  natapp[内网穿透] |  ngrok[内网穿透] |  深蓝穿透[内网穿透] |  WakeMeOnLan[查看ip] |  iis7 |  [漏洞扫描]Dependency_Check官网 |  [图标UI]fontawesome官网 |  idea插件官网 |  路过图床官网 |  sha256在线解密 |  在线正则表达式测试 |  在线文件扫毒 |  KuangStudy | 
资源下载
电脑相关: Windows原装下载msdn我告诉你 |  U盘制作微PE工具官网下载 |  Linux_CentOS官网下载 |  Linux_Ubuntu官网下载 |  Linux_OpenSUSE官网下载 |  IE浏览器官网下载 |  firefox浏览器官网下载 |  百分浏览器官网下载 |  谷歌google浏览器历史版本下载 |  深度deepin系统官网下载 |  中兴新支点操作系统官网下载 |  文件对比工具Beyond Compare官网下载 |  开机启动程序startup-delayer官网下载 |  openoffice官网下载 |  utorrent官网下载 |  qbittorrent官网下载 |  cpu-z官网下载 |  蜘蛛校色仪displaycal官网下载 |  单文件制作greenone下载 |  win清理工具Advanced SystemCare官网下载 |  解压bandizip官网下载 |  内存检测工具memtest官网下载 |  磁盘坏道检测与修复DiskGenius官网下载 |  磁盘占用可视化SpaceSniffer官网下载 |  [磁盘可视化]WizTree官网下载 |  win快速定位文件Everything官网下载 |  文件定位listary官网下载 |  动图gifcam官网下载 |  7-Zip官网下载 |  磁盘分区工具diskgenius官网下载 |  CEB文件查看工具Apabi Reader官网下载 |  罗技鼠标options官网下载 |  [去除重复文件]doublekiller官网下载 | 
编程相关: ApacheServer官网下载 |  Apache官网下载 |  Git官网下载 |  Git高速下载 |  Jboss官网下载 |  Mysql官网下载 |  Mysql官网历史版本下载 |  NetBeans IDE官网下载 |  Spring官网下载 |  Nginx官网下载 |  Resin官网下载 |  Tomcat官网下载 |  jQuery历史版本下载 |  nosql官网下载 |  mongodb官网下载 |  mongodb_linux历史版本下载 |  mongodb客户端下载 |  VScode官网下载 |  cxf官网下载 |  maven官网下载 |  QT官网下载 |  SVN官网下载 |  SVN历史版本下载 |  nodeJS官网下载 |  oracle官网下载 |  jdk官网下载 |  STS官网下载 |  STS历史版本官网下载 |  vue官网下载 |  virtualbox官网下载 |  docker desktop官网下载 |  github desktop官网下载 |  EditPlus官网下载 |  zTree下载 |  layui官网下载 |  jqgrid官网下载 |  jqueryui官网下载 |  solr历史版本下载 |  solr分词器ik-analyzer-solr历史版本下载 |  zookeeper历史版本官网下载 |  nssm官网下载 |  elasticsearch官网下载 |  elasticsearch历史版本官网下载 |  redis官网下载 |  redis历史版本官网下载 |  redis的win版本下载 |  putty官网下载 |  查看svn密码TSvnPD官网下载 |  MongoDB连接工具Robo官网下载 |  dll查看exescope官网下载 |  dll2c官网下载 |  接口测试apipost官网下载 |  接口测试postman官网下载 |  原型设计工具AxureRP官网下载 |  canal官网下载 |  idea主题样式下载 |  vue的GitHub下载 |  finalShell官网下载 |  ETL工具kafka官网下载 |  cavaj[java反编译]官网下载 |  jd-gui[java反编译]官网下载 |  radmin[远程连接]官网下载 |  tcping[win ping端口]下载 |  jQueryUploadFile官网下载 |  RedisPlus下载 |  aiXcoder智能编程助手官网下载 |  [表单效验]validform官网下载 |  idea官网下载 |  RedisStudio下载 |  MD转word含公式pandoc官网下载 |  logviewer官网下载 |  Kafka官网下载 |  hbase高速下载 |  hadoop官网下载 |  hadooponwindows的GitHub下载 |  hive官网下载 |  soapui官网下载 |  flink官网下载 |  kafkatool官网下载 |  MinIO官网下载 |  MinIO中国镜像下载 | 
办公相关工具
免费在线拆分PDF【不超过30M】 |  免费在线PDF转Word【不超过10M】 |  在线文字识别转换【不超过1M】 |  PDF转换成Word【不超过50M】 |  在线OCR识别 |  Smallpdf |  文件转换器Convertio |  迅捷PDF转换器 |  字母大小写转换工具 |  档铺 |  快传airportal[可文字] |  快传-文叔叔 |  P2P-小鹿快传 |  [图床]ImgURL | 
网站入口
腾讯文档 |  有道云笔记网页版 |  为知笔记网页版 |  印象笔记网页版 |  蓝奏云 |  QQ邮箱 |  MindMaster在线思维导图 |  bilibili |  PDM文件在线打开 |  MPP文件在线打开 |  在线PS软件 |  在线WPS |  阿里云企业邮箱登陆入口 | 
其他
PDF转换 |  悦书PDF转换 |  手机号注册查询 |  Reg007 |  akmsg |  ip8_ip查询 |  ipip_ip查询 |  天体运行testtubegames |  测试帧率 |  在线网速测试 |