效果

刚进来页面的样子

在第二个选项卡上方时

点击后

离开

同样第三个

点击

移走鼠标

代码

 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
<title>选项卡式导航</title>
<style type="text/css">
<!--
* {
margin: 0; padding:0
}
body {
margin-top: 10px;
margin-right: 10%;
margin-bottom: 10px;
margin-left: 10%;
text-align: center;
height: auto;
width: auto;
background-color: #666666;
font-size: 12px;
color: #000000;
}
#container {
text-align: left;
width: 760px;
height: 400px;
padding: 20px;
}
#container #title {
height: 28px;
}
#container #title li {
float: left;
list-style-type: none;
height: 28px;
line-height: 28px;
text-align: center;
margin-right: 1px;
}
#container #title ul {
height: 28px;
}
#container #title a {
text-decoration: none;
color: #000000;
display: block;
width: auto;
}
#container #title a span{
display: block;
padding: 0 15px 0 15px;
}
#container #title #tag1 a:hover {
text-decoration: none;
display: block;
width: auto;
}
#container #title #tag1 a:hover span{
display: block;
background-color: dodgerblue;
padding: 0 15px 0 15px;
}
#container #title #tag2 a:hover {
text-decoration: none;
display: block;
width: auto;
}
#container #title #tag2 a:hover span{
background-color: dodgerblue;
display: block;
padding: 0 15px 0 15px;
}
#container #title #tag3 a:hover {
text-decoration: none;
display: block;
width: auto;
}
#container #title #tag3 a:hover span{
background-color: dodgerblue;
display: block;
padding: 0 15px 0 15px;
}
#container #title #tag4 a:hover {
text-decoration: none;
display: block;
width: auto;
}
#container #title #tag4 a:hover span{
background-color: dodgerblue;
display: block;
padding: 0 15px 0 15px;
}
#container #title #tag5 a:hover {
text-decoration: none;
display: block;
width: auto;
}
#container #title #tag5 a:hover span{
background-color: dodgerblue;
display: block;
padding: 0 15px 0 15px;
}
#container #title .selectli1 {
text-decoration: none;
color: #ffffff;
display: block;
width: auto;
}
#container #title a .selectspan1 {
display: block;
padding: 0 15px 0 15px;
}
#container #title .selectli2 {
text-decoration: none;
color: #ffffff;
display: block;
width: auto;
}
#container #title a .selectspan2 {
display: block;
padding: 0 15px 0 15px;
}
#container #title .selectli3 {
text-decoration: none;
color: #ffffff;
display: block;
width: auto;
}
#container #title a .selectspan3 {
display: block;
padding: 0 15px 0 15px;
}
#container #title .selectli4 {
text-decoration: none;
color: #ffffff;
display: block;
width: auto;
}
#container #title a .selectspan4 {
display: block;
padding: 0 15px 0 15px;
}
#container #title .selectli5 {
text-decoration: none;
color: #ffffff;
display: block;
width: auto;
}
#container #title a .selectspan5 {
display: block;
padding: 0 15px 0 15px;
}
#container #content ul {margin: 10px;}
#container #content li {margin: 5px; }
#container #content li img {margin: 5px;display:block;}
#container #content {
height: 300px;
padding: 10px;
}
.content1 {
border-top-width: 3px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #3A81C8;
border-right-color: #3A81C8;
border-bottom-color: #3A81C8;
border-left-color: #3A81C8;
background-color: #DFEBF7;
}
.content2 {
border-top-width: 3px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #ff950b;
border-right-color: #ff950b;
border-bottom-color: #ff950b;
border-left-color: #ff950b;
background-color: #FFECD2;
}
.content3 {
height: 300px;
padding: 10px;
border-top-width: 3px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #FE74B8;
border-right-color: #FE74B8;
border-bottom-color: #FE74B8;
border-left-color: #FE74B8;
background-color: #FFECF5;
}
.content4 {
height: 300px;
padding: 10px;
border-top-width: 3px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #00988B;
border-right-color: #00988B;
border-bottom-color: #00988B;
border-left-color: #00988B;
background-color: #E8FFFD;
}
.content5 {
height: 300px;
padding: 10px;
border-top-width: 3px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #A8BC1F;
border-right-color: #A8BC1F;
border-bottom-color: #A8BC1F;
border-left-color: #A8BC1F;
background-color: #F7FAE2;
}
.hidecontent {display:none;}
-->
</style>
<script language="javascript">
function switchTag(tag,content)
{
// alert(tag);
// alert(content);
for(i=1; i < 6; i++)
{
if ("tag"+i==tag)
{
document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;
document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")
[0].className="selectspan"+i;
}else{
document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";
document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")
[0].className="";
}
if ("content"+i==content)
{
document.getElementById(content).className="";
}else{
document.getElementById("content"+i).className="hidecontent";
}
document.getElementById("content").className=content;
}
}
</script>
</head>
<body>
<div id="container">
<div id="title">
<ul>
<li id="tag1"><a href="#" onclick="switchTag('tag1','content1');this.blur();" class="selectli1"><span
class="selectspan1">首页</span></a></li>
<li id="tag2"><a href="#" onclick="switchTag('tag2','content2');this.blur();"><span>下载中心</span></a></li>
<li id="tag3"><a href="#" onclick="switchTag('tag3','content3');this.blur();"><span>产品介绍</span></a></li>
<li id="tag4"><a href="#" onclick="switchTag('tag4','content4');this.blur();"><span>会员注册与登录</span></a></li>
<li id="tag5"><a href="#" onclick="switchTag('tag5','content5');this.blur();"><span>联系我们</span></a></li>
</ul>
</div>
<div id="content" class="content1">
<div id="content1" >1、根据字数自适应项目长度</div>
<div id="content2" class="hidecontent">2、不同的项目使用不同的颜色来区分</div>
<div id="content3" class="hidecontent">3、这回需要使用到js了,呵呵</div>
<div id="content4" class="hidecontent">4、背景图片只需要两个图片文件就足够,减少服务器负担</div>
<div id="content5" class="hidecontent">5、这是使用到的两个图片</div>
</div>
</div>
</body>
</html>

jsp选项卡导航实现——模板的更多相关文章

  1. EasyMvc入门教程-基本控件说明(13)选项卡导航

    选项卡Tab导航主要用于企业页面显示不同子类或者子页面的信息内容. 先来一个基本的使用例子:代码如下: @{ var data = new List<TabItem>() { new Ta ...

  2. 30个实用的jQuery选项卡/导航教程推荐

    很多网站设计中都使用了选项卡(tabs),在制作选项卡时应用jQuery能够实现很多炫酷的过渡和动画效果.本文为你介绍30个实用的jQuery选项卡教程,希望对你有帮助. 1. Animated Ta ...

  3. springmvc 配置多视图,返回jsp,velocity,freeMarker,tiles(模板)等等

    springmvc-servlet.xml配置 <!-- Velocity --> <bean id="velocityViewResolver" class = ...

  4. bootstrap 响应式导航条模板(含下拉菜单,弹出框)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. jsp+struts2登录框架模板

    一.建立一个名叫jsp_struts2的项目 二.导入jar包 如上图:jar包导入在WebContent/WEB-INF/lib下 三.建立一个LoginAction类 LoginAction类的s ...

  6. jsp+servlet登录框架模板

    一.建立一个名叫jsp_servlet的工程 二.建立一个AcountBean类和CheckAccount类 1.AcountBean类包含登录名(username)和登录密码(password) p ...

  7. jsp动态导航栏

    站点页面的导航栏是从数据库中生成出来的,所以在界面上展示导航栏时,要从数据库中读取出来,但不能每次显示一个页面都从数据库中读.这样就非常浪费性能.应该考虑把导航栏放到一个缓存中.如:session.a ...

  8. 在Eclipse中修改Jsp页面的新增模板

    打开Eclipse的Preferences页面 路径: Window à Preferences 搜索"jsp",点击"Templates",选择要修改的Jsp ...

  9. myeclipse10 中修改html,servlet,jsp等的生成模板

    1.进入myeclipse的安装目录 2.用减压软件,(如winrar)打开common\plugins\com.genuitec.eclipse.wizards_9.0.0.me2011080913 ...

随机推荐

  1. 为什么在Java中不使用finalize()方法

    我们都知道finalize()方法是回收分配给对象的内存之前调用垃圾收集器线程的基本语句.在这篇文章中,我们将会深入这个方法. 这篇文章中的章节: 1.finalize()方法不能保证执行(这个将要用 ...

  2. intellij idea 编码设置(乱码问题)

    一般把编辑器设置为 utf-8 如下设置: file-->setting-->editor-->file encodings-->

  3. The Highest Mark---hdu5501(问题转化 01背包)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5501 二维数组: #include<stdio.h> #include<iostre ...

  4. 关闭linux的防火墙

    有两道防火墙 第一道 iptables -L iptables -F systemctl disable firewalld 第二道 [root@python3 ~]# getenforce Enfo ...

  5. HttpRunnerManager平台异步生成及展示代码覆盖率报告

    ant+jacoco+jenkins+HttpRunnerManager代码覆盖率统计平台搭建 实现思路通过jenkins构建,并使用HttpRunnerManager异步实现报告更新与展示. 现在整 ...

  6. phpcms调用子栏目名称/文章怎么操作

    phpcms调用子栏目名称相对比较简单一些,也是用{pc:content}来调用,只是把action设置为category,catid如果为0的话是调用所有一级栏目,如果是其他数字的话,则调用相应栏目 ...

  7. 3D游戏引擎中常见的三维场景管理方法

    对于一个有很多物体的3D场景来说,渲染这个场景最简单的方式就是用一个List将这些物体进行存储,并送入GPU进行渲染.当然,这种做法在效率上来说是相当低下的,因为真正需要渲染的物体应该是视椎体内的物体 ...

  8. w命令

    命 令:w 功能说明:显示目前登入系统的用户信息. 语 法:w [-fhlsuV][用户名称] 补充说明:执行这项指令可得知目前登入系统的用户有那些人,以及他们正在执行的程序.单独执行w 指令会显示所 ...

  9. Linux系统——最小化安装

    一.虚拟机进行Linux minimal 安装 网络连接:选择“自定义”——>VMnet8(NAT模式) #PC与NAT网络的虚拟机在不同网段,此时虚拟网卡作为网关建立通信 NAT模式可直接上I ...

  10. [笔记] Ubuntu 18.04源码安装caffe流程

    虽然Ubuntu 18.04可以通过apt安装caffe,但是为了使用最新的代码,还是值得从源码安装一遍的. 安装环境 OS: Ubuntu 18.04 64 bit 显卡: NVidia GTX 1 ...