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!

how can i display a different image each day of the month?

Status
Not open for further replies.

estesflyer

Programmer
Joined
Dec 19, 2000
Messages
284
Location
US
Im wanting to set my site up, to where i dont have to change the image out (the image displays the date) every day. i will create all the images each month, and then upload them, then, i dont have to worry about it. Also keep in mind, that I am wanting the image (the date on the image) to be right, no matter what the timezone is. it might have something to do w/

if (todays date is the first)
{
var image="this image.gif";
}
else if (todays date is the second)
{
var image="second image.gif";
}

anyway, if anyone knows how that could be done, PLZ lemme know!

thx a million!!!


- Rusty
 
Rusty,

Why wouldn't you just build an Array of the file names and then use the Javascript.Date.getDate() method to pick the name from the array? Or am I missing something?

var DateImages = new Array("d1.gif","d2.gif","d3.gif",...);
var dt = new Date();
var image = DateImages[dt.getDate()];

-pete
 
well, that is exactly what i would do, except me and arrays have a big problem understanding eachother. I have looked at several tutorials, including the webmonkey tutorials, and still, they havent come clear to me at all! i know what rthey are, but i dont know how to use them, OR how they work....

TIA

- Rusty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top