回答編集履歴
3
chousei
answer
CHANGED
@@ -6,14 +6,15 @@
|
|
6
6
|
# sample
|
7
7
|
とりあえず共通化できるものはまとめました。
|
8
8
|
あとは技得点とかグループ得点とか計算根拠を提示してください
|
9
|
+
|
10
|
+
group3(ラジオ版)を追記
|
9
11
|
```javascript
|
10
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
11
12
|
<script>
|
12
13
|
$(function(){
|
13
|
-
$('.group
|
14
|
+
$('.group .G').on('change',function(){
|
14
15
|
var sum=parseInt($(this).closest('.group').find('.G:checked').map(function(){
|
15
16
|
return parseFloat($(this).val());
|
16
|
-
}).get().reduce(function(x,y){
|
17
|
+
}).get().concat([0]).reduce(function(x,y){
|
17
18
|
return x+y;
|
18
19
|
})*10)/10;
|
19
20
|
$(this).closest('.group').find('.total').text(sum);
|
@@ -25,7 +26,7 @@
|
|
25
26
|
<h2>グループ得点:<span id="group_total">0</span>点 </h2>
|
26
27
|
<div class= "group">
|
27
28
|
<table border>
|
28
|
-
<tr><th colspan="6"><input type = "checkbox" class="
|
29
|
+
<tr><th colspan="6"><input type = "checkbox" class="G" value = "0.5" >グループ1</th></tr>
|
29
30
|
<tr><th>A難度</th><th>B難度</th><th>C難度</th><th>D難度</th><th>E難度</th><th>F難度</th></tr>
|
30
31
|
<tr>
|
31
32
|
<td><label><input type="checkbox" class="G" value="0.1">後振り上がり倒立</label></td>
|
@@ -35,12 +36,12 @@
|
|
35
36
|
<td><input type="checkbox" class="G" value="0.5"></td>
|
36
37
|
<td><input type="checkbox" class="G" value="0.6"></td>
|
37
38
|
</tr>
|
38
|
-
<tr><td colspan="6"
|
39
|
+
<tr><td colspan="6">合計点:<span class="total">0</span>点</td></tr>
|
39
40
|
</table>
|
40
41
|
</div>
|
41
42
|
<div class= "group">
|
42
43
|
<table border>
|
43
|
-
<tr><th colspan="6"><input type = "checkbox" class="
|
44
|
+
<tr><th colspan="6"><input type = "checkbox" class="G" value = "0.5">グループ2</th></tr>
|
44
45
|
<tr><th>A難度</th><th>B難度</th><th>C難度</th><th>D難度</th><th>E難度</th><th>F難度</th></tr>
|
45
46
|
<tr align="center">
|
46
47
|
<td><label><input type="checkbox" class="G" value="0.1">前宙</label></td>
|
@@ -51,8 +52,27 @@
|
|
51
52
|
<td><label><input type="checkbox" class="G" value="0.6">前宙</label></td>
|
52
53
|
</tr>
|
53
54
|
<tr>
|
54
|
-
<td colspan="6"
|
55
|
+
<td colspan="6">合計点:<span class="total">0</span>点</td>
|
55
56
|
</tr>
|
56
57
|
</table>
|
57
58
|
</div>
|
59
|
+
<div class= "group">
|
60
|
+
<table border>
|
61
|
+
<tr><th colspan="6"><input type = "radio" class="G" value = "0.5">グループ3</th></tr>
|
62
|
+
<tr><th>A難度</th><th>B難度</th><th>C難度</th><th>D難度</th><th>E難度</th><th>F難度</th></tr>
|
63
|
+
<tr align="center">
|
64
|
+
<td><label><input type="radio" class="G" value="0.1">前宙</label></td>
|
65
|
+
<td><label><input type="radio" class="G" value="0.2">前宙</label></td>
|
66
|
+
<td><label><input type="radio" class="G" value="0.3">前宙</label></td>
|
67
|
+
<td><label><input type="radio" class="G" value="0.4">前宙</label></td>
|
68
|
+
<td><label><input type="radio" class="G" value="0.5">前宙</label></td>
|
69
|
+
<td><label><input type="radio" class="G" value="0.6">前宙</label></td>
|
70
|
+
</tr>
|
71
|
+
<tr>
|
72
|
+
<td colspan="6">合計点:<span class="total">0</span>点</td>
|
73
|
+
</tr>
|
74
|
+
</table>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
58
78
|
```
|
2
chousei
answer
CHANGED
@@ -1,3 +1,58 @@
|
|
1
1
|
[前回](https://teratail.com/questions/192399#reply-285432)もお伝えしたとおりidが競合しているのでその修正から
|
2
2
|
|
3
|
-
もしかして同じページ内に同じidが存在してはいけないルールを理解されていませんか?
|
3
|
+
もしかして同じページ内に同じidが存在してはいけないルールを理解されていませんか?
|
4
|
+
|
5
|
+
|
6
|
+
# sample
|
7
|
+
とりあえず共通化できるものはまとめました。
|
8
|
+
あとは技得点とかグループ得点とか計算根拠を提示してください
|
9
|
+
```javascript
|
10
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
11
|
+
<script>
|
12
|
+
$(function(){
|
13
|
+
$('.group :checkbox').on('change',function(){
|
14
|
+
var sum=parseInt($(this).closest('.group').find('.G:checked').map(function(){
|
15
|
+
return parseFloat($(this).val());
|
16
|
+
}).get().reduce(function(x,y){
|
17
|
+
return x+y;
|
18
|
+
})*10)/10;
|
19
|
+
$(this).closest('.group').find('.total').text(sum);
|
20
|
+
});
|
21
|
+
});
|
22
|
+
</script>
|
23
|
+
<h1>合計得点:<span id="all_total">0</span>点 </h1>
|
24
|
+
<h2>技得点:<span id="waza_total">0</span>点 </h2>
|
25
|
+
<h2>グループ得点:<span id="group_total">0</span>点 </h2>
|
26
|
+
<div class= "group">
|
27
|
+
<table border>
|
28
|
+
<tr><th colspan="6"><input type = "checkbox" class="G1" value = "0.5" id="G1">グループⅠ</th></tr>
|
29
|
+
<tr><th>A難度</th><th>B難度</th><th>C難度</th><th>D難度</th><th>E難度</th><th>F難度</th></tr>
|
30
|
+
<tr>
|
31
|
+
<td><label><input type="checkbox" class="G" value="0.1">後振り上がり倒立</label></td>
|
32
|
+
<td><label><input type="checkbox" class="G" value="0.2">片逆手後ろ振り上がり一回ひねり(片逆手)倒立</label></td>
|
33
|
+
<td><input type="checkbox" class="G" value="0.3"></td>
|
34
|
+
<td><input type="checkbox" class="G" value="0.4"></td>
|
35
|
+
<td><input type="checkbox" class="G" value="0.5"></td>
|
36
|
+
<td><input type="checkbox" class="G" value="0.6"></td>
|
37
|
+
</tr>
|
38
|
+
<tr><td colspan="6" align="center">合計点:<span class="total">0</span>点</td></tr>
|
39
|
+
</table>
|
40
|
+
</div>
|
41
|
+
<div class= "group">
|
42
|
+
<table border>
|
43
|
+
<tr><th colspan="6"><input type = "checkbox" class="G2" value = "0.5" id="G2">グループⅡ</th></tr>
|
44
|
+
<tr><th>A難度</th><th>B難度</th><th>C難度</th><th>D難度</th><th>E難度</th><th>F難度</th></tr>
|
45
|
+
<tr align="center">
|
46
|
+
<td><label><input type="checkbox" class="G" value="0.1">前宙</label></td>
|
47
|
+
<td><label><input type="checkbox" class="G" value="0.2">前宙</label></td>
|
48
|
+
<td><label><input type="checkbox" class="G" value="0.3">前宙</label></td>
|
49
|
+
<td><label><input type="checkbox" class="G" value="0.4">前宙</label></td>
|
50
|
+
<td><label><input type="checkbox" class="G" value="0.5">前宙</label></td>
|
51
|
+
<td><label><input type="checkbox" class="G" value="0.6">前宙</label></td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td colspan="6" align="center">合計点:<span class="total">0</span>点</td>
|
55
|
+
</tr>
|
56
|
+
</table>
|
57
|
+
</div>
|
58
|
+
```
|
1
chousei
answer
CHANGED
@@ -1,1 +1,3 @@
|
|
1
|
-
[前回](https://teratail.com/questions/192399#reply-285432)もお伝えしたとおりidが競合しているのでその修正から
|
1
|
+
[前回](https://teratail.com/questions/192399#reply-285432)もお伝えしたとおりidが競合しているのでその修正から
|
2
|
+
|
3
|
+
もしかして同じページ内に同じidが存在してはいけないルールを理解されていませんか?
|