superstar2k9
Technical User
hi basicly what i am trying to do is update the images on my site due to time of day i am running a website for a local radio station and as each Dj starts there work there image will appear on the page i found theis javascript from here
I have not tested this code yet i want to insert images into this script that i have on the sit and set them to change by setting the time of day could someone anyone copy and paste this making it a little clearer on what or where i need to edit it for instants if a Dj is on air between 6pm and 8pm and there image is names jess.jpg (NOTE) The images will be in my source files on the server not coming from a url. how or where would this be entered into the code or is there a widget that can handle this and the code embeded to my site would be easyier many thanks.
--------------------------------------------------------------------------
This is the 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">body{background: white url(1st.jpg); color: black}"></style>')
} else
if(x>=4 && x<12) **
document.write('<style type="text/css">body{background: white url(2nd.jpg); color: black}</style>')
} else
if(x>=12 && x<18) **
document.write('<style type="text/css">body{background: white url(3rd.jpg); color: black}</style>')
} else
if (x>=18 && x<24) **
document.write('<style type="text/css">body{background: white url(4th.jpg); color: black}</style>')
}
</script>
I have not tested this code yet i want to insert images into this script that i have on the sit and set them to change by setting the time of day could someone anyone copy and paste this making it a little clearer on what or where i need to edit it for instants if a Dj is on air between 6pm and 8pm and there image is names jess.jpg (NOTE) The images will be in my source files on the server not coming from a url. how or where would this be entered into the code or is there a widget that can handle this and the code embeded to my site would be easyier many thanks.
--------------------------------------------------------------------------
This is the 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">body{background: white url(1st.jpg); color: black}"></style>')
} else
if(x>=4 && x<12) **
document.write('<style type="text/css">body{background: white url(2nd.jpg); color: black}</style>')
} else
if(x>=12 && x<18) **
document.write('<style type="text/css">body{background: white url(3rd.jpg); color: black}</style>')
} else
if (x>=18 && x<24) **
document.write('<style type="text/css">body{background: white url(4th.jpg); color: black}</style>')
}
</script>