Streaming live at 10am (PST)

Change Content Based on Day


#1

I'm trying to change the content of a div block based on the day of the week. I'd like to have it change just based on the day (Monday, Tuesday, etc.) and each week can be the same, so a total of 7 different content styles.

What I'm trying to achieve is a "Flavor of the Day" section for a bakery site. The div block will likely contain text, an image, and a link. Anyone have any code on how to do this? I found the code below, but this looks like it's just good for images.

<script type="text/javascript"><!--
var imlocation = "images/";
 function ImageArray (n) {
   this.length = n;
   for (var i =1; i <= n; i++) {
     this[i] = ' '
   }
 }
image = new ImageArray(7);
image[0] = 'sunday.gif';
image[1] = 'monday.gif';
image[2] = 'tuesday.gif';
image[3] = 'wednesday.gif';
image[4] = 'thursday.gif';
image[5] = 'friday.gif';
image[6] = 'saturday.gif';
var currentdate = new Date();
var imagenumber = currentdate.getDay();
document.write('<img src="' + imlocation + image[imagenumber] + '">');
//--></script>

#2

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.