table表格信息的展开和缩小

本文介绍了一个使用JSP技术实现的学生信息展示页面。页面通过Java后端获取学生数据,并利用jQuery实现表格中数据的动态显示与隐藏。此外,还设置了缓存控制策略并引入了样式表文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<%@ 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>

运行效果如下


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值