質問編集履歴

2

コードの修正

2021/06/25 13:15

投稿

nguyenseiji
nguyenseiji

スコア156

test CHANGED
File without changes
test CHANGED
@@ -78,23 +78,63 @@
78
78
 
79
79
  switch (param+","+intension) {
80
80
 
81
- case "0,png":
81
+ case "0,png":
82
82
 
83
- alert(intension);
83
+ elem.outerHTML = '<img id="Image01" class="MainImage1" src="" />';
84
84
 
85
- $Image01 = Document.getElementById("Image01");
85
+ var elem = document.getElementById("Image01");
86
-
87
- // $Image01.innerHTML = '<img id="Image01" class="MainImage1" src="" />';
88
86
 
89
87
  elem.src = "../wounise/gamelist/2/img/kellen-riggin-oQQ1bxY8Exc-unsplash.jpg";
90
88
 
91
89
  break;
92
90
 
91
+
92
+
93
+
94
+
95
+ case "0,mp4":
96
+
97
+ elem.outerHTML = '<video><source src="" type=""></video>';
98
+
99
+ var elem = document.getElementById("Image01");
100
+
101
+ elem.src = "../wounise/gamelist/2/img/BestLife.mp4";
102
+
93
- case 1:
103
+ break;
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ case "1,png":
116
+
117
+ elem.outerHTML = '<img id="Image01" class="MainImage1" src="" />';
118
+
119
+ var elem = document.getElementById("Image01");
94
120
 
95
121
  elem.src = "../wounise/gamelist/2/img/toan-nguyen-eVqaLcolf4k-unsplash.jpg";
96
122
 
97
123
  break;
124
+
125
+
126
+
127
+ case "1,mp4":
128
+
129
+ elem.outerHTML = '<video><source src="" type=""></video>';
130
+
131
+ var elem = document.getElementById("Image01");
132
+
133
+ elem.src = "../wounise/gamelist/2/img/BestLife.mp4";
134
+
135
+ break;
136
+
137
+
98
138
 
99
139
  case 2:
100
140
 

1

zds

2021/06/25 13:15

投稿

nguyenseiji
nguyenseiji

スコア156

test CHANGED
File without changes
test CHANGED
@@ -13,3 +13,117 @@
13
13
 
14
14
 
15
15
  的な事をSWITCH文を使ってコードを記載したいと思っております...
16
+
17
+
18
+
19
+ ```html
20
+
21
+ <div class="Contena_MainImage">
22
+
23
+ <img id="Image01" class="MainImage1" src="../wounise/gamelist/2/img/kellen-riggin-oQQ1bxY8Exc-unsplash.jpg" />
24
+
25
+
26
+
27
+ <hr/>
28
+
29
+ <div class="Contena_SecondImage">
30
+
31
+
32
+
33
+ <a href="javascript:void(0);" onclick="LinkClick(0,`png`);"><img class="SecondImage1" src="../wounise/gamelist/2/img/kellen-riggin-oQQ1bxY8Exc-unsplash.jpg"></img>
34
+
35
+ </a><br/>
36
+
37
+ <a href="javascript:void(0);" onclick="LinkClick(1,`mp4`);"><img class="SecondImage1" src="../wounise/gamelist/2/img/toan-nguyen-eVqaLcolf4k-unsplash.jpg"></img>
38
+
39
+ </a><br/>
40
+
41
+ <a href="javascript:void(0);" onclick="LinkClick(2);"><img class="SecondImage1" src="../wounise/gamelist/2/img/erwans-socks-RUdgCetWUDc-unsplash.jpg"></img>
42
+
43
+ </a><br/>
44
+
45
+ <a href="javascript:void(0);" onclick="LinkClick(5);"><img class="SecondImage1" src="../wounise/gamelist/2/img/erwans-socks-RUdgCetWUDc-unsplash.jpg"></img>
46
+
47
+ </a><br/>
48
+
49
+ <a href="javascript:void(0);" onclick="LinkClick(4);"><img class="SecondImage1" src="../wounise/gamelist/2/img/erwans-socks-RUdgCetWUDc-unsplash.jpg"></img>
50
+
51
+ </a><br/>
52
+
53
+ <a href="javascript:void(0);" onclick="LinkClick(5);"><img class="SecondImage1" src="../wounise/gamelist/2/img/graham-mansfield-YXyo7zCqQs4-unsplash.jpg"></img>
54
+
55
+ </a><br/>
56
+
57
+
58
+
59
+ </div>
60
+
61
+ </div>
62
+
63
+ ```
64
+
65
+
66
+
67
+
68
+
69
+ ```javascript
70
+
71
+ <script type="text/javascript">
72
+
73
+ function LinkClick(param,intension) {
74
+
75
+ var elem = document.getElementById("Image01");
76
+
77
+
78
+
79
+ switch (param+","+intension) {
80
+
81
+ case "0,png":
82
+
83
+ alert(intension);
84
+
85
+ $Image01 = Document.getElementById("Image01");
86
+
87
+ // $Image01.innerHTML = '<img id="Image01" class="MainImage1" src="" />';
88
+
89
+ elem.src = "../wounise/gamelist/2/img/kellen-riggin-oQQ1bxY8Exc-unsplash.jpg";
90
+
91
+ break;
92
+
93
+ case 1:
94
+
95
+ elem.src = "../wounise/gamelist/2/img/toan-nguyen-eVqaLcolf4k-unsplash.jpg";
96
+
97
+ break;
98
+
99
+ case 2:
100
+
101
+ elem.src = "../wounise/gamelist/2/img/toan-nguyen-eVqaLcolf4k-unsplash.jpg";
102
+
103
+ break;
104
+
105
+ case 3:
106
+
107
+ elem.src = "../wounise/gamelist/2/img/tommy-nguyen-QRwwfeDdC-w-unsplash.jpg";
108
+
109
+ break;
110
+
111
+ case 4:
112
+
113
+ elem.src = "../wounise/gamelist/2/img/erwans-socks-RUdgCetWUDc-unsplash.jpg";
114
+
115
+ break;
116
+
117
+ default:
118
+
119
+ elem.src = "../wounise/gamelist/2/img/graham-mansfield-YXyo7zCqQs4-unsplash.jpg";
120
+
121
+ break;
122
+
123
+ }
124
+
125
+ }
126
+
127
+ </script>
128
+
129
+ ```