Hi there,
Basically, I've got a script which changes the page background depending on the time.
So as you can see, the first background changes between at 4am and so on.
What I would look to do is to change the background at different times every day, reading from some sort of text file or something. For example, on the 10th June the first background changes at 4:15am and the others with different times, on the 11th June the first background changes at 4:22am or something and so on.
Could someone possibly find me or write me something to do this? I can't find anything anywhere!
Thanks ever so much
Basically, I've got a script which changes the page background depending on the time.
Code:
<script language="JavaScript">
day=new Date() //..get the date
x=day.getHours() //..get the hour
if(x>=0 && x<4) {
document.write('<style type="text/css">#header{background: white url(images/assets/1st.jpg); color: black}"></style>')
} else
if(x>=4 && x<12) {
document.write('<style type="text/css">#header{background: white url(images/assets/2nd.jpg); color: black}"></style>')
} else
if(x>=12 && x<18) {
document.write('<style type="text/css">#header{background: white url(images/assets/3rd.jpg); color: black}"></style>')
} else
if (x>=18 && x<24) {
document.write('<style type="text/css">#header{background: white url(images/assets/4th.jpg); color: black}"></style>')
}
</script>
What I would look to do is to change the background at different times every day, reading from some sort of text file or something. For example, on the 10th June the first background changes at 4:15am and the others with different times, on the 11th June the first background changes at 4:22am or something and so on.
Could someone possibly find me or write me something to do this? I can't find anything anywhere!
Thanks ever so much
Comment