Change background daily..... - Post...

User 495282 Photo


Registered User
132 posts

I have been using some javascript to change an image on a website daily. I am in the process of tinkering with the idea of having a background image change daily. Is it possible within VSD? The code I am presently using is:

<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.PNG';
image[1] = 'monday.PNG';
image[2] = 'tuesday.PNG';
image[3] = 'wednesday.PNG';
image[4] = 'thursday.PNG';
image[5] = 'friday.PNG';
image[6] = 'saturday.PNG';
var currentdate = new Date();
var imagenumber = currentdate.getDay();
document.write('<img src="' + imlocation + image[imagenumber] + '">');
//--></script>

Could changes to this script be applicable to background images, and if so, what changes need to be made? Any input is surely appreciated.


Booth Kates

Patience...Persistence...Practice

http://www.boothkates.com
http://www.susiekatesdesigns.com
http://www./paradisecovemarinahs.com
http://www.thehillsab.com

User 2147626 Photo


Ambassador
2,958 posts

You might be able to do something with this ... http://www.phoenix.frihost.net/chameleon/read_me.php?time=15:53:21 CST&&n=1

Bottom line, if you google "background image rotation" then you will get all sorts of info. I just love Google! :cool:
Graphics for the web, email, blogs and more!
-------------------------------------
https://sadduck.com
User 495282 Photo


Registered User
132 posts

Gunsmoke.......thanks for taking the time to respond......I have googled (is that a proper verb?) all sorts of word combinations regarding this. Unfortunately, most involve changing the bg color or image every few seconds or on re-load of the page. I don't want that much activity. A simple once a day change will suffice. I was hoping to tinker with the current script to create what I want. In its present configuration, it works perfectly on a site now. I am also concerned about how a script involving a daily bg change might conflict with the "built-in" process that VSD provides. How could that be overcome? Thanks again for your time.
Booth Kates

Patience...Persistence...Practice

http://www.boothkates.com
http://www.susiekatesdesigns.com
http://www./paradisecovemarinahs.com
http://www.thehillsab.com

User 2484360 Photo


Registered User
3,293 posts

User 495282 Photo


Registered User
132 posts

Thanks, Adam.....Saw this script a couple of days ago......was a le intimidated by the "Page copy protected against web site content infringement by Copyscapel" message. But it sees to be closer to a solution. I'm going to give it a try. If it works, I'll contact the content provider before using in a public domain.
Booth Kates

Patience...Persistence...Practice

http://www.boothkates.com
http://www.susiekatesdesigns.com
http://www./paradisecovemarinahs.com
http://www.thehillsab.com

User 603315 Photo


Registered User
938 posts

I haven't tried it but this should work. Put it where your images show up. Unfortunately it's old style Javascript, but still.

<script language=javascript>


newday=new Date();
day=newday.getDay();

var numberofimages = 7;
images = new Array(numberofimages+1);
images[0] = "<img src='Mon.jpg'>";
images[1] = "<img src='Tue.jpg'>";
images[2] = "<img src='Wed.jpg'>";
images[3] = "<img src='Thu.jpg'>";
images[4] = "<img src='Fri.jpg'>";
images[5] = "<img src='Sat.jpg'>";
images[6] = "<img src='Sun.jpg'>";

document.write(images[day]);

</script>

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.