|
Hi All,
I'm looking for a script that will function for a radio station website. I'd like it to be able to display a specific image during specific times of day. The times need to be based on server time, not the viewer's PC clock. I've found scripts that come close to what i'm looking for, but they either only display text OR they are based on the viewer's PC clock instead of server time.
Example:
From 8am - 12 Noon, display the title of the show AND the host's picture.
From 12 Noon - 3:30pm, display the title of the next show AND the host's picture.
...and so on.
Html code for time?
You'll need to look into using whatever server-side scripting language you have available for your site. Most commonly it will either be PHP or ASP.
Instead of HTML, you'll write a small piece of code that prints HTML to the screen based on a conditional statement. This is not the actual code, but it should be based on something like:
if (current time is x)
then (show image abc)
else (show image 123)
You should be able to do a more specific search for conditional statements when you decide on which scripting language to use.
Html code for time?
well, if you make it a javaServer Page, you can use
<%java.util.Date now = new java.util.Date(); %>
<% now %>
It's necesary to use a server side technology to be sure it's accurate.
if you want to approximate it with JAVASCRIPT rather than java, you can take the users date and convert it. The problem here may be apparent: there's no guarentee the users clock is CORRECT or that they havn't set the wrong timezone and adjusted their clock to be correct based on a wrong timezone.
userTime = date.getHours()
offset = date.getTimezoneOffset()
and then change the date to your time based on the difference from your time:
date.setHours(userTime + (offset - stationsOffset));
Html code for time?
Cool clock:
_
|