By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,601 Members | 1,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,601 IT Pros & Developers. It's quick & easy.

Script to change images with each visit

P: n/a
I am looking for a javascript that will provide a new image each time the
viewer opens the web page. At present, I am using a date code and have
changed it to show images. But I think it only works for seven days and I
have 30 images to show. Here is what I have cobbled together. I am sure
there is a better way, but I am JS challenged to say the least. I appreciate
this newsgroup. Dick Ross

<script type="text/javascript">
var now = new Date();
var day = now.getDay();
var arday = new Array("images/crewfolder/alexcason_s.jpg",
"images/crewfolder/fran_100", "images/crewfolder/maino_s.jpg",
"images/crewfolder/rick_s.jpg", "images/crewfolder/self1_20s.jpg",
"images/crewfolder/peggy_s.jpg", "images/crewfolder/maino_s.jpg");
var artxt = new Array("Alex Cason", "Fran Maddox", "Steve Maino",
"Rick Wheaton", "Dick Ross", "Steve Yates", "Peggy Lawrey");

document.write("<img src='" + arday[day] + "'>");
document.write("<br>Today's photo artist is " + artxt[day]);
</script>
Jan 25 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Figured it out, Thanks, though, Dick Ross
"ross" <ro***@everestkc.net> wrote in message
news:58**************************@EVERESTKC.NET...
I am looking for a javascript that will provide a new image each time the
viewer opens the web page. At present, I am using a date code and have
changed it to show images. But I think it only works for seven days and I
have 30 images to show. Here is what I have cobbled together. I am sure
there is a better way, but I am JS challenged to say the least. I
appreciate this newsgroup. Dick Ross

<script type="text/javascript">
var now = new Date();
var day = now.getDay();
var arday = new Array("images/crewfolder/alexcason_s.jpg",
"images/crewfolder/fran_100", "images/crewfolder/maino_s.jpg",
"images/crewfolder/rick_s.jpg", "images/crewfolder/self1_20s.jpg",
"images/crewfolder/peggy_s.jpg", "images/crewfolder/maino_s.jpg");
var artxt = new Array("Alex Cason", "Fran Maddox", "Steve Maino",
"Rick Wheaton", "Dick Ross", "Steve Yates", "Peggy Lawrey");

document.write("<img src='" + arday[day] + "'>");
document.write("<br>Today's photo artist is " + artxt[day]);
</script>

Jan 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.