質問編集履歴

1

記載漏れ

2021/11/15 12:34

投稿

ken1115
ken1115

スコア0

test CHANGED
File without changes
test CHANGED
@@ -50,4 +50,96 @@
50
50
 
51
51
  }
52
52
 
53
+ function countdownTimer1(){
54
+
55
+ var nowDate = new Date();
56
+
57
+ var period = endtime - nowDate;
58
+
59
+ var addZero = function(n){return('0'+n).slice(-2);}
60
+
61
+ if(period > 0) {
62
+
63
+ var min = Math.floor(period / (1000 * 60));
64
+
65
+ period -= (min * (1000 * 60));
66
+
67
+ var sec = Math.floor(period / 1000);
68
+
69
+ period -= (sec * 1000);
70
+
71
+ var milli = Math.floor(period / 10);
72
+
73
+ var insert = "";
74
+
75
+ insert += '残り時間 <span>00:' + addZero(min) + ':' + '</span>';
76
+
77
+ insert += '<span>' + addZero(sec) + ':' + '</span>';
78
+
79
+ insert += '<span>' + addZero(milli) + '</span>';
80
+
81
+ document.getElementById('timer3').innerHTML = insert;
82
+
83
+ setTimeout(countdownTimer1, interval);
84
+
85
+ } else {
86
+
87
+ var insert = "";
88
+
89
+ insert += '';
90
+
91
+ document.getElementById('timer3').innerHTML = insert;
92
+
93
+ }
94
+
95
+ }
96
+
97
+ function countdownTimer2(){
98
+
99
+ var nowDate = new Date();
100
+
101
+ var period = endtime - nowDate;
102
+
103
+ var addZero = function(n){return('0'+n).slice(-2);}
104
+
105
+ if(period > 0) {
106
+
107
+ var min = Math.floor(period / (1000 * 60));
108
+
109
+ period -= (min * (1000 * 60));
110
+
111
+ var sec = Math.floor(period / 1000);
112
+
113
+ period -= (sec * 1000);
114
+
115
+ var milli = Math.floor(period / 10);
116
+
117
+ var insert = "";
118
+
119
+ insert += '残り時間 <span>00:' + addZero(min) + ':' + '</span>';
120
+
121
+ insert += '<span>' + addZero(sec) + ':' + '</span>';
122
+
123
+ insert += '<span>' + addZero(milli) + '</span>';
124
+
125
+ document.getElementById('timer4').innerHTML = insert;
126
+
127
+ setTimeout(countdownTimer2, interval);
128
+
129
+ } else {
130
+
131
+ var insert = "";
132
+
133
+ insert += '';
134
+
135
+ document.getElementById('timer4').innerHTML = insert;
136
+
137
+ }
138
+
139
+ }
140
+
141
+ countdownTimer1();
142
+
143
+ countdownTimer2();
144
+
53
145
  ```