开发者

Timed Based Events for Website

I was wondering if it was possible to make a small script in Jquery that would change an image at a certain time.

For my site, I want the image for t开发者_如何学运维he opening and closing of a facility to change when it opens and closes.

Is this possible with Jquery or should I go with something else? Actionscript/Flash? I can't use PHP on the site...


You don't even need JQuery, although that has code that will help. You just need to test the Date object and go from there. For example, code like this changes a greeting based on time of day -- no reason why you can't tweak that to do what you need:

Stackoverflow: Setting a greeting based on user's time (Good morning, good afternoon…)

EDIT: I ought to have made it clear that as one might expect, Date works with the date / time on the client machine.


http://plugins.jquery.com/project/timers

you create function callback that loads a new image from an array of image links


You may want to use a function such as getTimeZoneOffset(), you can get the local time in GMT, add the offset for the actual location of the facility, then you base all of your calculations of GMT time, then regardless of where you site is looked at, it will show the correct status.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜