function getTimeGreat() {
    var h = (new Date()).getHours();
    if (h >= 15 && h < 19)
        return "下午好";
    if (h >= 11 && h < 15)
        return "中午好";
    if (h >= 19 && h < 22)
        return "晚上好";
    if (h >= 22 && h <= 24 || h >= 0 && h < 6)
        return "深夜好";
    if (h >= 6 && h < 11)
        return "早上好";
}
document.write(getTimeGreat());

 

相关文章:

  • 2021-11-13
  • 2022-12-23
  • 2021-11-28
  • 2022-01-01
  • 2022-12-23
  • 2021-11-18
  • 2022-02-17
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-09-30
  • 2022-01-21
  • 2022-02-08
  • 2021-08-01
相关资源
相似解决方案