質問編集履歴

1

表示コードを部分的に変更しました。

2016/10/03 10:16

投稿

matsudaira
matsudaira

スコア8

test CHANGED
File without changes
test CHANGED
@@ -30,191 +30,7 @@
30
30
 
31
31
  ```ここに言語を入力
32
32
 
33
- <!DOCTYPE html>
34
33
 
35
- <html lang="ja">
36
-
37
- <head>
38
-
39
- <meta charset="utf-8">
40
-
41
- <title>Numeber Game</title>
42
-
43
- <style>
44
-
45
- body {
46
-
47
- background: #e0e0e0;
48
-
49
- font-family: Arial, sans-serif;
50
-
51
- text-align: center;
52
-
53
- color: #0088cc;
54
-
55
- font-size: 16px;
56
-
57
- }
58
-
59
- #scoreArea {
60
-
61
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
62
-
63
- margin: 30px auto;
64
-
65
- }
66
-
67
- #scoreText {
68
-
69
- font-weight: bold;
70
-
71
- font-size: 24px;
72
-
73
- }
74
-
75
- #startButton {
76
-
77
- margin: 30px auto;
78
-
79
- width: 180px;
80
-
81
- border-radius: 5px;
82
-
83
- box-shadow: 0 4px 0 #e91b0c;
84
-
85
- background: #f44336;
86
-
87
- color: #fff;
88
-
89
- cursor: pointer;
90
-
91
- padding: 7px;
92
-
93
- }
94
-
95
- #startButton:hover {
96
-
97
- opacity: 0.8;
98
-
99
- }
100
-
101
- #startButton.pushed {
102
-
103
- margin-top: 32px;
104
-
105
- box-shadow: 0 2px 0 #e91b0c;
106
-
107
- }
108
-
109
- .btn {
110
-
111
- display: inline-block;
112
-
113
- width: 40px;
114
-
115
- padding: 7px;
116
-
117
- border-radius: 5px;
118
-
119
- box-shadow: 0 4px 0 #0088cc;
120
-
121
- color: #fff;
122
-
123
- background: #00aaff;
124
-
125
- cursor: pointer;
126
-
127
- margin-bottom: 10px;
128
-
129
- }
130
-
131
- .btn + .btn {
132
-
133
- margin-left: 10px;
134
-
135
- }
136
-
137
- .btn.inactive {
138
-
139
- opacity: 0.5;
140
-
141
- }
142
-
143
- </style>
144
-
145
- </head>
146
-
147
- <body>
148
-
149
- <div id="scoreArea">Your Score: <span id="scoreText">0.0</span></div>
150
-
151
- <div id="board">
152
-
153
- <!-- <div class="btn">0</div>
154
-
155
- <div class="btn">1</div><br>
156
-
157
- <div class="btn">2</div>
158
-
159
- <div class="btn">3</div> -->
160
-
161
- </div>
162
-
163
- <div id="startButton" class="pushed">START</div>
164
-
165
- <script>
166
-
167
- (function() {
168
-
169
- "use strict";
170
-
171
- var size = 2;
172
-
173
-
174
-
175
- var board = document.getElementById("board");
176
-
177
-
178
-
179
- initBoard();
180
-
181
-
182
-
183
- function createButton(num) {
184
-
185
- var button;
186
-
187
- button = document.createElement("div");
188
-
189
- button.className = "btn";
190
-
191
- button.innerHTML = num;
192
-
193
- return button;
194
-
195
- }
196
-
197
-
198
-
199
- function initBoard() {
200
-
201
- var buttons = [];
202
-
203
- //buttons
204
-
205
- //0,1,2,3
206
-
207
- for (var i = 0; i < size * size; i++) {
208
-
209
- buttons.push(createButton(i));
210
-
211
- }
212
-
213
-
214
-
215
- //シャッフル
216
-
217
- //boardに追加
218
34
 
219
35
  while (buttons.length) {
220
36
 
@@ -226,21 +42,7 @@
226
42
 
227
43
  board.appendChild(document.createElement("br"));
228
44
 
229
- }
45
+
230
-
231
- }
232
-
233
- }
234
-
235
- })();
236
-
237
- </script>
238
-
239
- </body>
240
-
241
- </html>
242
-
243
-
244
46
 
245
47
 
246
48
 
@@ -248,6 +50,8 @@
248
50
 
249
51
  課題に対してアプローチしたことを記載してください
250
52
 
53
+ ご指摘いただいた通り、board.appendChild(button[0]);→board.appendChild(buttons[0]);へ変更してみましたが、まだ反映されないです。
54
+
251
55
 
252
56
 
253
57
  ###補足情報(言語/FW/ツール等のバージョンなど)