diff --git a/10.css b/10.css index 4de90e9..40a1f5a 100644 --- a/10.css +++ b/10.css @@ -1,12 +1,24 @@ body{ - text-align: center; + background-color: #e5d4ea; } -div{ +div.container{ + display: flex; + flex-wrap: wrap; + justify-content:center; +} +div.container div{ background-color: #ffbbbb; border: 2px solid #312a2a; - margin: 10px 100px; + margin: 1px; } p{ - text-align: left; + text-align: center; padding-left: 10px; + padding: 0 30px; } +p#info{ + font-size: 20px; +} +button#start{ + font-size: 20px; +} \ No newline at end of file diff --git a/10.html b/10.html index 4d0edbe..9de56e9 100644 --- a/10.html +++ b/10.html @@ -10,17 +10,19 @@

STARTを押してから時間内に1~10を選んでね

- +

-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

+
+

1

+

2

+

3

+

4

+

5

+

6

+

7

+

8

+

9

+

10

+
\ No newline at end of file diff --git a/10.js b/10.js index e9c0733..2369af6 100644 --- a/10.js +++ b/10.js @@ -1,10 +1,9 @@ function CountDown() { - var count = 4, tmID, infobox = document.getElementById("start"), atari = document.getElementById("true"),finish = document.getElementById("info"); - function CountDown() { + var count = 4,tmID,infobox = document.getElementById("start"), atari = document.getElementById("true"),finish = document.getElementById("info"); + function CountDown(){ if (--count == 0) { finish.innerHTML = "終了"; atari.removeEventListener("click", stopCountDown, false); - } else { finish.innerHTML = count + "秒前"; tmID = setTimeout(CountDown, 1000); diff --git a/random.html b/random.html new file mode 100644 index 0000000..57eb0ec --- /dev/null +++ b/random.html @@ -0,0 +1,26 @@ + + + + + 出会って3秒で爆発 + + + + + +

STARTを押してから時間内に1~10を選んでね

+

+ +

+

1

+

2

+

3

+

4

+

5

+

6

+

7

+

8

+

9

+

10

+ + \ No newline at end of file diff --git a/random.js b/random.js new file mode 100644 index 0000000..2369af6 --- /dev/null +++ b/random.js @@ -0,0 +1,29 @@ +function CountDown() { + var count = 4,tmID,infobox = document.getElementById("start"), atari = document.getElementById("true"),finish = document.getElementById("info"); + function CountDown(){ + if (--count == 0) { + finish.innerHTML = "終了"; + atari.removeEventListener("click", stopCountDown, false); + } else { + finish.innerHTML = count + "秒前"; + tmID = setTimeout(CountDown, 1000); + } + } + function startCountDown() { + tmID = setTimeout(CountDown, 1000);/*100ms=1秒*/ + infobox.removeEventListener("click", startCountDown, false); + atari.addEventListener("click", stopCountDown, false); + } + function stopCountDown() { + if (count >= 0) { + clearTimeout(tmID); + infobox.innerHTML = "爆発阻止成功です!"; + } + + finish.innerHTML = "終了"; + atari.innerHTML = "爆弾みーっけ"; + atari.removeEventListener("click", stopCountDown, false); + } + infobox.addEventListener("click", startCountDown, false); +}; +document.addEventListener("DOMContentLoaded", CountDown, false); \ No newline at end of file