diff --git a/dokan.js b/dokan.js index b7bda6a..2573764 100644 --- a/dokan.js +++ b/dokan.js @@ -1,5 +1,5 @@ function CountDown() { - var count = 3; + var count = 10; var tmID; var infobox = document.getElementById("info"); var start = document.getElementById("start"); @@ -15,7 +15,7 @@ } function startCountDown() { - tmID = setTimeout(countDown, 1000); + tmID = setTimeout(countDown, 500); var list = document.getElementsByTagName('div'); for (let i of list){ i.removeEventListener("click", startCountDown, false); diff --git a/getElementsByTagName.html b/getElementsByTagName.html index 5b977fa..838ce36 100644 --- a/getElementsByTagName.html +++ b/getElementsByTagName.html @@ -19,6 +19,5 @@

keypress

keydown

keyup

- \ No newline at end of file diff --git a/getElementsByTagName.js b/getElementsByTagName.js index c602e0a..63b19cc 100644 --- a/getElementsByTagName.js +++ b/getElementsByTagName.js @@ -1,4 +1,16 @@ function change(){ - var myp = document.getElementsByTagName("p"); - myp.innerHTML = "正解!"; + var tag = document.getElementsByTagName("p"); + tag[0].innerHTML = "正解!"; + tag[1].innerHTML = "正解!"; + tag[2].innerHTML = "正解!"; + tag[3].innerHTML = "正解!"; + tag[4].innerHTML = "正解!"; + tag[5].innerHTML = "正解!"; + tag[6].innerHTML = "正解!"; + tag[7].innerHTML = "正解!"; + tag[8].innerHTML = "正解!"; + tag[9].innerHTML = "正解!"; + tag[10].innerHTML = "正解!"; + tag[11].innerHTML = "正解!"; + tag[12].innerHTML = "正解!"; } \ No newline at end of file diff --git a/timer/timer.css b/timer/timer.css new file mode 100644 index 0000000..e50cc50 --- /dev/null +++ b/timer/timer.css @@ -0,0 +1,25 @@ +html, body { + font-family: serif; + font-size: 16px; + } + + .countdown-container { + margin: 5rem; + } + + .time-container { + display: flex; + } + + .time { + margin: .2rem; + background-color: lightpink; + border-radius: 1rem; + padding: 2rem; + } + + #hour,#min,#sec { + font-size: 3rem; + margin-right: 1rem; + } + \ No newline at end of file diff --git a/timer/timer.html b/timer/timer.html new file mode 100644 index 0000000..55293b8 --- /dev/null +++ b/timer/timer.html @@ -0,0 +1,20 @@ + + + + +Countdown Timer + + + +
+

Countdown to end of today 🎉

+

You have ...

+
+

hours

+

minutes

+

seconds

+
+
+ + + \ No newline at end of file diff --git a/timer/timer.js b/timer/timer.js new file mode 100644 index 0000000..b5b4f08 --- /dev/null +++ b/timer/timer.js @@ -0,0 +1,21 @@ +const hour = document.getElementById("hour"); +const min = document.getElementById("min"); +const sec = document.getElementById("sec"); + +function countdown() { + const now = new Date(); // 現在時刻を取得 + const tomorrow = new Date(now.getFullYear(),now.getMonth(),now.getDate()+1); // 明日の0:00を取得 + const diff = tomorrow.getTime() - now.getTime(); // 時間の差を取得(ミリ秒) + + // ミリ秒から単位を修正 + const calcHour = Math.floor(diff / 1000 / 60 / 60); + const calcMin = Math.floor(diff / 1000 / 60) % 60; + const calcSec = Math.floor(diff / 1000) % 60; + + // 取得した時間を表示(2桁表示) + hour.innerHTML = calcHour < 10 ? '0' + calcHour : calcHour; + min.innerHTML = calcMin < 10 ? '0' + calcMin : calcMin; + sec.innerHTML = calcSec < 10 ? '0' + calcSec : calcSec; +} +countdown(); +setInterval(countdown,1000); \ No newline at end of file diff --git a/which.html b/which.html new file mode 100644 index 0000000..779d416 --- /dev/null +++ b/which.html @@ -0,0 +1,11 @@ + + + + getElementById + + + + + + + \ No newline at end of file diff --git a/which.js b/which.js new file mode 100644 index 0000000..e168257 --- /dev/null +++ b/which.js @@ -0,0 +1,3 @@ +if (条件式) { + 条件式が成り立った場合処理を実行 +} \ No newline at end of file