I am wondering if it would be possible to set the display of a grahic on a website to change depending on the time of day it is. Say I want to have a night and day photgraph of a building on the website. Now can I have the page load with the proper picture relating to the time of day using if-then statements or would I need to try soemthing else if it is possible at all? Thank you!
Ya surely you can do that with the help of the Date reference. I am just giving u the sample idea. In the window.onload have a function like this
[HTML]function checkDay()
{
var todate = new Date();
var hour = todate.getHours()
if(Hours<17) //upto Evening five
document.getElementById('picPosition').innerHTML = "Picture during Day Time";
else
document.getElementById('picPosition').innerHTML = "Picture during Night Time";
}[/HTML]
See this is a sample code, just try yours if any probs post back it. I will try to help u out
I guess I am more lost then i realized. I copied this and pasted it into my file yet nothing happened. I amde the changes I thought I needed to make such as the file names, and still nothing. Am I missing something? Perhaps this is more complex of an element then i was prepared for. If anyone has the time out there and can break it down to being very simple then maybe I can make it work on my site. Thank you very much for any efforts.