一:图片预览
1)
2)
二:示例代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="<%=basePath %>js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.box p:not(:first)').hide();/*不是内容一的情况下隐藏掉内容*/
$('.box h1').hover(function(){
$(this).addClass('other');
},function(){
$(this).removeClass('other');
});
$('.box h1').click(function(){
$(this).next('p').slideToggle().siblings('p').slideUp();/*点击关闭其他内容(p)下的节点*/
});
});
</script>
<style type="text/css">
*{padding:0;margin:0;}
body {padding-left:400px;padding-top:100px;font:12px "宋体";}
.box {width:300px;border-bottom:1px solid #CDC9C9;}
.box h1 {height:30px;line-height:30px;padding:0 10px;font-size:12px; cursor:pointer;border:1px solid #CDC9C9;border-bottom:none;background:#EDEDED;}
.box h1.other {background-color:#CDC9C9}
.box p {padding:10px;border-left:1px solid #CDC9C9;border-right:1px solid #CDC9C9;}
</style>
</head>
<body>
<div class="box">
<h1>标题一</h1>
<p>内容一</p>
<h1>标题二</h1>
<p>内容二</p>
<h1>标题三</h1>
<p>内容三</p>
<h1>标题四</h1>
<p>内容四</p>
<h1>标题五</h1>
<p>内容五</p>
</div>
</body>
</html>