1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 <%
3 String path = request.getContextPath();
4 String basePath = request.getScheme() + "://"
5 + request.getServerName() + ":" + request.getServerPort()
6 + path + "/";
7 %>
8
9 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
10 <html>
11 <head>
12 <base href="<%=basePath%>">
13
14 <title>My JSP 'jquery.jsp' starting page</title>
15
16 <meta http-equiv="pragma" content="no-cache">
17 <meta http-equiv="cache-control" content="no-cache">
18 <meta http-equiv="expires" content="0">
19 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
20 <meta http-equiv="description" content="This is my page">
21 <script type="text/javascript" src="/common/easyui/jquery.min.js"></script>
22 <script type="text/javascript">
23 $(document).ready(function(){
24 $("tr:hidden").css("display","block");
25 });
26 </script>
27 </head>
28 <body>
29 <table>
30 <tr style="display:none"><td>Value 1</td></tr>
31 <tr><td>Value 2</td></tr>
32 </table>
33 </body>
34 </html>
30 <tr style="display:none"><td>Value 1</td></tr>
此行代码隐藏了tr
24 $("tr:hidden").css("display","block");
此行代码选中了所有tr为hidden的元素,指定显示方式为block
重点解释:
:hidden
匹配所有的不可见元素,input 元素的 type 属性为 "hidden" 的话也会被匹配到
$("tr:hidden")
查找type为hidden的tr元素
相似知识点:
:visible
匹配所有的可见元素
$("tr:visible")
查找type为visible的tr元素