destoon js判断早上好,上午好,下午好,傍晚好,晚上好


来源: https://destoon.cc/ 时间: 2019-03-01 22:18:32 人气: 542 评论: 0

<script language="javascript">

now = new Date();

hour = now.getHours();

 if(hour < 6){document.write("凌晨好!")}

 else if (hour < 9){document.write("早上好!")}

else if (hour < 12){document.write("上午好!")}

else if (hour < 14){document.write("中午好!")}

else if (hour < 17){document.write("下午好!")}

else if (hour < 19){document.write("傍晚好!")}

else if (hour < 23){document.write("晚上好!")}

else {document.write("夜里好!")}

</script>

destoon js 上午好 下午好 傍晚好 晚上好

评论
346655709