回答編集履歴

1

例のhtmlを編集

2016/12/15 05:44

投稿

motuo
motuo

スコア3027

test CHANGED
@@ -4,18 +4,90 @@
4
4
 
5
5
 
6
6
 
7
- ```javascript
7
+ ```html
8
8
 
9
- $(function(){
9
+ <html>
10
10
 
11
- $(".list td:not(td.imgLink)").click(function () {
11
+ <head>
12
12
 
13
- var id = $(this).parent().attr("testId");
13
+ <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
14
14
 
15
- location.href = "${contextPath}/edit/" + id + "/";
15
+ <script>
16
16
 
17
- });
17
+ $(function(){
18
18
 
19
+ $(".list td:not(td.imgLink)").click(function () {
20
+
21
+ var id = $(this).parent().attr("testId");
22
+
23
+ location.href = "${contextPath}/edit/" + id + "/";
24
+
19
- });
25
+ });
26
+
27
+ });
28
+
29
+ </script>
30
+
31
+ <style type="text/css">
32
+
33
+ .list tr:hover td {
34
+
35
+ background:#FFF7CD;
36
+
37
+ color:#000000;
38
+
39
+ }
40
+
41
+ .list td{
42
+
43
+ padding:0.3em 1em;
44
+
45
+ cursor: pointer;
46
+
47
+ }
48
+
49
+ </style>
50
+
51
+ </head>
52
+
53
+ <body>
54
+
55
+ <table class="list">
56
+
57
+ <tr>
58
+
59
+ <th>ID</th>
60
+
61
+ <th>名前</th>
62
+
63
+ </tr>
64
+
65
+ <tr testId="1000">
66
+
67
+ <td>1000</td>
68
+
69
+ <td>松尾芭蕉</td>
70
+
71
+ </tr>
72
+
73
+ <tr testId="2000">
74
+
75
+ <td>2000</td>
76
+
77
+ <td>金子みすず</td>
78
+
79
+ </tr>
80
+
81
+ <tr testId="3000">
82
+
83
+ <td>3000</td>
84
+
85
+ <td>与謝野晶子</td>
86
+
87
+ </tr>
88
+
89
+ </body>
90
+
91
+ </html>
20
92
 
21
93
  ```