473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Change images according to Time

Hi,

Do you have any javascript available for changing images according to time ?
let say Morning (7am-12pm), using images 1 (e.g morning.jpg)
Afternoon (12 - 6pm), using images 2 (e.g afternoon.jpg)
Night (6pm - 7am), using images 3 (e.g night.jpg)

thanks.

Magix
Mar 5 '06 #1
1 3692
JRS: In article <44**********@news.tm.net.my>, dated Mon, 6 Mar 2006
03:52:30 remote, seen in news:comp.lang.javascript, magix
<ma***@asia.com> posted :

Do you have any javascript available for changing images according to time ?
let say Morning (7am-12pm), using images 1 (e.g morning.jpg)
Afternoon (12 - 6pm), using images 2 (e.g afternoon.jpg)
Night (6pm - 7am), using images 3 (e.g night.jpg)


If you had read the newsgroup FAQ, you should have found your way to js-
date0.htm#SS "Scheduled Selection" which can be simplified from hour-of-
week to hour-of-day.

It is not wise to divide the day into a.m. and p.m. within IT work; it
leads to unnecessary complication. Everyone should understand the
24-hour clock.

For only three images, you may prefer to use, rather than a List, a Case
statement, conditional statements, or a conditional expression such as
T<7 || T>18 ? "n.jpg" : T<12 ? "m.jpg" : "a.jpg"

You need to decide what you mean by, say, 6 pm; is it to be 18:00 UT,
18:00 Malaysian time, or 18:00 reader's time?

You also need to decide whether the image is chosen only when the page
loads, or whether it will be changed at 07:00, 12:00 and 18:00.

You could divide the day into equal intervals of Night, Morning,
Afternoon, and Evening, and use numbered images addressed as
Math.floor(T/6) + ".jpg"
or ((T/6)|0) + ".jpg"

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Mar 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Benoit St-Jean | last post by:
I am looking at options/ways to store 12 million gif/jpg images in a database. Either we store a link to the file or we store the image itself in the database. Images will range from 4k to 35k in...
2
by: DiggidyMack69 | last post by:
Hello folks I have a rolling image script that works fine except that the images do not seem to be preloading properly. The images are still being pulled on every interval from the server...
4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
3
by: Miguel Dias Moura | last post by:
Hello, i know how to hide a table according to a condition: <table runat="server" visible='<%# dataSetBibliotecas.FieldValue("Titulo", Container) <> "" %>'... Now I am trying to change the...
3
by: vj | last post by:
how to change images based on action. Even clicking changed images should do respective actions. and while displaying only one image at a time sholud get displayed. I am using three images for a...
19
RMWChaos
by: RMWChaos | last post by:
Previously, I had used independent JSON lists in my code, where the lists were part of separate scripts. Because this method did not support reuse of a script without modification, I decided to...
5
by: rosaryshop | last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php. As the user makes selections, it updates images of various parts, giving them a preview of the...
25
by: Peng Yu | last post by:
Hi, It is possible to change the length of "\t" to a number other than 8. std::cout << "\t"; Thanks, Peng
7
by: Keith Hughitt | last post by:
Hi all, I am having trouble preloading images in a javascript application, and was wondering if anyone had any suggestions. Basically I have a bunch of images stored in a database as BLOBs. At...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.