如何按一天中的时间更改 div 内容?
我希望能够根据用户的时间改变某个div的内容。 例如,如果现在是凌晨 5 点,则会显示某些内容。如果是早上 6 点,则会显示另一个内容。
John Doe 8am-4pm (changes to that name when its 8am-4pm)
John Doe 5pm-6pm (changes to that name when its 5pm-6pm)
John Doe 7pm-8pm (changes to that name when its 7pm-8pm)
我正在使用 http://www.venivortex.com/open-source/jquery- rotator.php 但它不起作用。有人知道类似的事情吗?
任何帮助表示赞赏!
I want to be able to change the content of a certain div according to the time of the user.
For example, if it's 5am, certain content would show. If it's 6am, another content shows.
John Doe 8am-4pm (changes to that name when its 8am-4pm)
John Doe 5pm-6pm (changes to that name when its 5pm-6pm)
John Doe 7pm-8pm (changes to that name when its 7pm-8pm)
I was using http://www.venivortex.com/open-source/jquery-rotator.php but it doesn't work. Anyone know of something similar?
Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
非常简洁
的实例: http://jsfiddle.net/9dUJ6/
用 else if 扩展
https://developer .mozilla.org/en/JavaScript/Reference/Global_Objects/Date 提供日期对象的概述,
w3schools 也是如此
http://www.w3schools.com/jsref/jsref_obj_date.asp
very tersely
live example: http://jsfiddle.net/9dUJ6/
expand with else if
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date provides and overview of the date object
so too does w3schools
http://www.w3schools.com/jsref/jsref_obj_date.asp
像 this 这样的东西对你来说应该是一个好的开始:
Something like this should be a good start for you: