Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image refresher question

Status
Not open for further replies.

mileslevi

Technical User
Joined
Jan 18, 2006
Messages
1
Location
US
Hey. I have a website in which an cirtin image is refreshed automaticaly through the script below. What I need is a modified version of this script in which the script will show (and not refresh if possible) and different image between cirtin hours on the day (10pm-8am est). Thanks for any help.

Included Script:
<script language="JavaScript" type="text/javascript">
var refreshrate=30; //SECONDS BETWEEN REFRESH
var image="path/to/image"; //IMAGE NAME
var imgheight=240; //IMAGE HEIGHT
var imgwidth=320; //IMAGE WIDTH
function refresh(){
document.images["pic"].src=image+"?"+new Date();
setTimeout('refresh()', refreshrate*1000);}
document.write('<IMG SRC="'+image+'" ALT="Alternate Text" NAME="pic" ID="pic" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" STYLE="border: 1px solid Black;">');
if(document.images)window.onload=refresh;
</script>
 
I would take the approach of putting your images into an array in "chronological" order. Assuming your images are used for equal parts of the day, then you would just get the time at loading, translate that into the image array index, and get that image.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top