使用倒数计时脚本时出现一些错误。在这里找不到解决方案。错误消息每秒产生1个错误:
Uncaught TypeError: Cannot set property 'textContent' of null
at (index):181
(anonymous) @ (index):181
setInterval (async)
(anonymous) @ (index):179
这是计时器的脚本:
<script type="text/javascript">
var timeleft = 45;
var downloadTimer = setInterval(function(){
timeleft--;
document.getElementById("countdowntimer").textContent = timeleft;
document.getElementById("countdowntimer").style.color = "white";
if(timeleft <= 0)
clearInterval(downloadTimer);
},1000);
</script>
答案 0 :(得分:0)
您的html(根据您的评论)无效(out = (df['On/Off'].shift().eq('On') & df['On/Off'].eq('Off')).sum()
print (out )
2
)。此外,可以简化代码。
print ((df['On/Off'].shift().eq('On') & df['On/Off'].eq('Off')))
0 False
1 False
2 False
3 False
4 False
5 False
6 False
7 False
8 False
9 False
10 False
11 False
12 False
13 False
14 True
15 False
16 False
17 False
18 False
19 False
20 False
21 False
22 False
23 False
24 False
25 False
26 False
27 False
28 False
29 False
30 False
31 False
32 False
33 False
34 False
35 False
36 False
37 False
38 False
39 False
40 False
41 False
42 False
43 False
44 True
45 False
46 False
47 False
48 False
49 False
Name: On/Off, dtype: bool
</span class="timer">