回答編集履歴
2
間違った
answer
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
どんぴしゃな回答がamaranthineさんから出ているのでjqueryを使わない方法で。
|
2
2
|
```HTML
|
3
3
|
<script type="text/javascript">
|
4
|
-
|
4
|
+
window.onload = function() {
|
5
5
|
var ar = Array.prototype.slice.call(document.getElementsByTagName('input'));
|
6
6
|
for(e in ar) {
|
7
7
|
ar[e].onchange = function() {
|
1
ソースの変更
answer
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
どんぴしゃな回答がamaranthineさんから出ているのでjqueryを使わない方法で。
|
2
|
-
```
|
2
|
+
```HTML
|
3
3
|
<script type="text/javascript">
|
4
|
+
document.onload = function() {
|
4
|
-
var ar = Array.prototype.slice.call(document.getElementsByTagName('input'));
|
5
|
+
var ar = Array.prototype.slice.call(document.getElementsByTagName('input'));
|
5
|
-
for(e in ar) {
|
6
|
+
for(e in ar) {
|
6
|
-
|
7
|
+
ar[e].onchange = function() {
|
7
|
-
|
8
|
+
for(ee in ar) {
|
8
|
-
|
9
|
+
ar[ee].checked = false;
|
9
|
-
|
10
|
+
}
|
10
|
-
|
11
|
+
this.checked = true;
|
11
|
-
|
12
|
+
};
|
12
|
-
}
|
13
|
+
}
|
14
|
+
};
|
13
15
|
</script>
|
14
16
|
```
|