Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我只想在几个小时之间显示弹出窗口,例如在下午 1 点到下午 3 点之间,我如何通过获取时间并使用 if else 在 javascript 中做到这一点
试试这个:
var hours = (new Date()).getHours(); if (hours >= 13 && hours <= 15) { // show popup }