<html>
<body>
<p>点击按钮,在时间小于 20:00 时输出 "Good day"。</p>
<button onclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction() {
var time = new Date().getHours();
if (time < 20) {
document.getElementById("demo").innerHTML = "Good day";
}
}
</script>
</body>
</html>