<%@ page language="java"import="java.util.*"pageEncoding="UTF-8"%>
<%
Stringpath = request.getContextPath();
StringbasePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPEHTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN">
<html>
<head>
<basehref="<%=basePath%>">
<title>My JSP 'index4.jsp' startingpage</title>
<metahttp-equiv="pragma"content="no-cache">
<metahttp-equiv="cache-control"content="no-cache">
<metahttp-equiv="expires"content="0">
<metahttp-equiv="keywords"content="keyword1,keyword2,keyword3">
<metahttp-equiv="description"content="This is my page">
<linkrel="stylesheet"type="text/css"href="css/index9.css">
<scripttype="text/javascript"src="plug/jquery.js"></script>
</head>
<body>
<tablewidth="200px"height="100px"border="1">
<tr>
<td>编号</td>
<td>姓名</td>
<td>成绩</td>
</tr>
<tralign="left"class="parent"id="row1"><tdcolspan="3">学生信息</td></tr>
<trclass="child_row1">
<td>001</td>
<td>小明</td>
<td>80</td>
</tr>
<trclass="child_row1">
<td>002</td>
<td>张三</td>
<td>79</td>
</tr>
</table>
<scripttype="text/javascript">
$(function() {
$("tr.parent").click(function() {
$(this).toggleClass("selected").siblings('.child_'+this.id).toggle();
});
});
</script>
</body>
</html>
运行效果如下