本文实例讲述了jQuery实现table表格信息的展开和缩小功能。分享给大家供大家参考,具体如下:
<%@ page language="java"import="java.util.*"pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String Path = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN">
<html>
<head>
< href="<%= Path%>" rel="external nofollow" >
< >My JSP 'index4.jsp' startingpage</ >
< http-equiv="pragma" content="no-cache">
< http-equiv="cache-control" content="no-cache">
< http-equiv="expires" content="0">
< http-equiv="keywords" content="keyword1,keyword2,keyword3">
< http-equiv="de ion" content="This is my page">
< rel="stylesheet" type="text/css" href="css/index9.css" rel="external nofollow" >
< src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></ >
</head>
<body>
<table width="200px" height="100px" border="1">
<tr>
<td>编号</td>
<td>姓名</td>
<td>成绩</td>
</tr>
<tr align="left" class="parent" id="row1"><td colspan="3">学生信息</td></tr>
<tr class="child_row1">
<td>001</td>
<td>小明</td>
<td>80</td>
</tr>
<tr class="child_row1">
<td>002</td>
<td>张三</td>
<td>79</td>
</tr>
</table>
< type="text/ ">
$(function() {
$("tr.parent").click(function() {
$(this).toggleClass("selected").siblings('.child_'+this.id).toggle();
});
});
</ >
</body>
</html>
运行效果如下

更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery表格(table)操作技巧汇总》、《jQuery操作json数据技巧汇总》、《jQuery form操作技巧汇总》、《jQuery常用插件及用法总结》、《jQuery扩展技巧总结》及《jquery选择器用法总结》
希望本文所述对大家jQuery程序设计有所帮助。
继续阅读与本文标签相同的文章
上一篇 :
浅谈vue父子组件怎么传值
下一篇 :
隐私与AI兼得,蚂蚁金服是如何做到的?
-
公理设计-由奇怪海战引发的软件设计思考
2026-05-16栏目: 教程
-
分享35个高效编程的实用技巧
2026-05-16栏目: 教程
-
ThreadLocal 源码解读
2026-05-16栏目: 教程
-
怎样做网站性能优化?
2026-05-16栏目: 教程
-
Android APP性能优化总结
2026-05-16栏目: 教程
