質問編集履歴
3
あいまいなのでHTML側も追加しました
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
2
あいまいなのでHTML側も追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -21,23 +21,23 @@
|
|
21
21
|
|
22
22
|
以下省略
|
23
23
|
|
24
|
-
<div id="
|
24
|
+
<div id="id-1">
|
25
25
|
<img src="/assets/img/img-01.png">
|
26
26
|
</div>
|
27
27
|
|
28
|
-
<div id="
|
28
|
+
<div id="id-2">
|
29
29
|
<img src="/assets/img/img-02.png">
|
30
30
|
</div>
|
31
31
|
|
32
|
-
<div id="
|
32
|
+
<div id="id-3">
|
33
33
|
<img src="/assets/img/img-03.png">
|
34
34
|
</div>
|
35
35
|
|
36
|
-
<div id="
|
36
|
+
<div id="id-4">
|
37
37
|
<img src="/assets/img/img-04.png">
|
38
38
|
</div>
|
39
39
|
|
40
|
-
<div id="
|
40
|
+
<div id="id-5">
|
41
41
|
<img src="/assets/img/img-05.png">
|
42
42
|
</div>
|
43
43
|
|
@@ -65,9 +65,9 @@
|
|
65
65
|
return elements;
|
66
66
|
}
|
67
67
|
|
68
|
-
document.getElements('
|
68
|
+
document.getElements('id-1','id-2','id-3').style.display ="none";
|
69
69
|
function clickBtn1(){
|
70
|
-
const p1 = document.getElements('
|
70
|
+
const p1 = document.getElements('id-1','id-2','id-3');
|
71
71
|
if(p1.style.display=="block"){
|
72
72
|
p1.style.display ="none";
|
73
73
|
}else{
|
@@ -79,9 +79,9 @@
|
|
79
79
|
```ここに言語名を入力
|
80
80
|
// ひとつのid名で取得は下記でできています。
|
81
81
|
複数取得したいのです
|
82
|
-
document.getElementById("
|
82
|
+
document.getElementById("id-1").style.display ="none";
|
83
83
|
function clickBtn1(){
|
84
|
-
const p1 = document.getElementById("
|
84
|
+
const p1 = document.getElementById("id-1");
|
85
85
|
if(p1.style.display=="block"){
|
86
86
|
p1.style.display ="none";
|
87
87
|
}else{
|
1
あいまいなのでHTML側も追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,7 +5,45 @@
|
|
5
5
|
書き方がいまいちわからない状態で機能しません…
|
6
6
|
|
7
7
|
### 該当のソースコード
|
8
|
+
```ここに言語名を入力
|
9
|
+
// HTML
|
10
|
+
<a href="#">
|
11
|
+
<div onclick="clickBtn1()">
|
12
|
+
<img src="button01img.png" alt="01">
|
13
|
+
</div>
|
14
|
+
</a>
|
8
15
|
|
16
|
+
<a href="#">
|
17
|
+
<div onclick="clickBtn2()">
|
18
|
+
<img src="button02img.png" alt="02">
|
19
|
+
</div>
|
20
|
+
</a>
|
21
|
+
|
22
|
+
以下省略
|
23
|
+
|
24
|
+
<div id="p1">
|
25
|
+
<img src="/assets/img/img-01.png">
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div id="p2">
|
29
|
+
<img src="/assets/img/img-02.png">
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div id="p3">
|
33
|
+
<img src="/assets/img/img-03.png">
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="p4">
|
37
|
+
<img src="/assets/img/img-04.png">
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div id="p5">
|
41
|
+
<img src="/assets/img/img-05.png">
|
42
|
+
</div>
|
43
|
+
|
44
|
+
以下省略
|
45
|
+
```
|
46
|
+
|
9
47
|
```ここに言語名を入力
|
10
48
|
// 複数のid名で一括取得
|
11
49
|
function getElements(){
|
@@ -36,4 +74,18 @@
|
|
36
74
|
p1.style.display ="block";
|
37
75
|
}
|
38
76
|
}
|
77
|
+
```
|
78
|
+
|
79
|
+
```ここに言語名を入力
|
80
|
+
// ひとつのid名で取得は下記でできています。
|
81
|
+
複数取得したいのです
|
82
|
+
document.getElementById("p1").style.display ="none";
|
83
|
+
function clickBtn1(){
|
84
|
+
const p1 = document.getElementById("p1");
|
85
|
+
if(p1.style.display=="block"){
|
86
|
+
p1.style.display ="none";
|
87
|
+
}else{
|
88
|
+
p1.style.display ="block";
|
89
|
+
}
|
90
|
+
}
|
39
91
|
```
|