473,326 Members | 2,111 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,326 software developers and data experts.

Time Based Graphic Change Every Sunday?

I present a radio show on a voluntary radio station every Sunday between 3 and 5pm

Is there a script which will change one graphic between those times?

Be nice if my web page could change to "ON AIR", but it's beyond me how to do it.

TIA

Gary Jackson

Feb 18 '07 #1
4 1670
Gary Jackson said the following on 2/18/2007 9:27 AM:
I present a radio show on a voluntary radio station every Sunday between 3 and 5pm

Is there a script which will change one graphic between those times?

Be nice if my web page could change to "ON AIR", but it's beyond me how to do it.
Without having some server side support you won't have a reliable
answer. And even with server side support it still won't be fool proof.
The best you could do would be to use a setTimeout call to change the
image every so often (60 seconds) and have the server return the image
that is needed.

function changeImage(){
document.images['theImage'].src="getImage.php?"+(new Date().getTime())
}
var myTimer = window.setInterval(changeImage,60000)

With this HTML:

<image src="off_air.png" name="theImage">

And then have getImage.php return an "ON AIR" or "OFF AIR" image based
on the servers time. If the server and the radio show are in different
time zones then you will have to accommodate for that on the server.

Any solution will be dependent upon the clock being set properly and it
is easier to control the server clock than every users clock. It will
also depend on scripting being enabled.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 18 '07 #2
VK
On Feb 18, 5:27 pm, "Gary Jackson" <gary.jackson1NOT
T...@btinternet.comwrote:
I present a radio show on a voluntary radio station every Sunday between 3 and 5pm

Is there a script which will change one graphic between those times?

Be nice if my web page could change to "ON AIR", but it's beyond me how to do it.
1) That is for a station located in England (GMT) If it is not then
tell your time zone to adjust.

2) Respectively instead of "<p>ON AIR</p>" you can write your img tag

3) User clocks can be wrong or intentionally set on a wrong time but
as a "hint helper" for average users it is good enough.
<html>
<head>
<title>Gary Jackson's show</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript">
var now = new Date();
var day = now.getUTCDay();
var hrs = now.getUTCHours();

if ( (day == 0) && (hrs 2) && (hrs < 5) ) {
document.write('<p>ON AIR</p>');
}
else {
document.write('<p>OFF AIR</p>');
}
</script>
<noscript>
<p>Some nice message for users with script disabilities</p>
<p>It will not be shown to regular users</p>
</noscript>
</body>
</html>

Feb 18 '07 #3
VK wrote:
<html>
<head>
<title>Gary Jackson's show</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript">
var now = new Date();
var day = now.getUTCDay();
var hrs = now.getUTCHours();

if ( (day == 0) && (hrs 2) && (hrs < 5) ) {
document.write('<p>ON AIR</p>');
}
else {
document.write('<p>OFF AIR</p>');
}
</script>
<noscript>
<p>Some nice message for users with script disabilities</p>
<p>It will not be shown to regular users</p>
</noscript>
</body>
</html>
Thank you so much!

Gary
Feb 18 '07 #4
In comp.lang.javascript message <UL*********************@bt.com>, Sun,
18 Feb 2007 14:27:59, Gary Jackson <gary.jackson1NOT@THIS.?.com.invalid>
posted:
>I present a*radio show on a voluntary radio station every Sunday
between 3 and 5pm
*
Is there a script which will change one graphic between those times?
*
Be nice if my web page could change to "ON AIR", but it's beyond me how
to do it.
Please do not post in HTML/multipart - FAQ 2.3 para 5.

It is presumably 15:00 to 17:00 LCT (local civil time), independently of
whether we are in Summer or Winter time; and your listeners may all be
using UK/IE time. Otherwise, there is code on my site with which
foreigners can determine UK time; you could adapt that.

Since this is a mere convenience to the reader, you can give them the
burden of having a correctly-set clock. Nowadays, most personal
computer clocks are set from a network time server anyway.

The problem is akin to a graphical-digit clock, as in <URL:http://www.me
rlyn.demon.co.uk/js-anclk.htm#Dig>; but at each tick you only have to
decide whether you are ON or OFF.

with (new Date()) { D = getDay() ; H = getHours() }
DH = D*24 + H
ON = DH>=15 && DH<17

will do the choosing; you should be able to adapt it for other times of
the week.
You don't need graphics; you could change text, and put it in a large
coloured font.

It's a good idea to read the newsgroup and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Feb 19 '07 #5

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

Similar topics

10
by: soup_or_power | last post by:
Hi I have a requirement to compare the user entry for mm/dd/yy/HH/mm (month, day, year, hour, minute) to the Easter Standard Time. I am using the following script, but it is not giving the right...
43
by: Mike MacSween | last post by:
Or something to do with Nulls in PK. Which is obviously wrong. OK, after a diversion of having to earn money its back to the free one. The orchestral management system. At the E-R level: An...
6
by: Robm | last post by:
Since googling this issue only brings up the April fool's problem, which was solved years ago, I hope that somebody can help me with this. I have a large vc++/mfc application which needs to know...
6
by: sugapablo | last post by:
I have an old machine running Mandrake 9.2 and PHP 4.3.1 hosting several websites. With the coming changes to daylight savings time in March 2007, what are my options in correcting the current...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.