473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Script to change images with each visit

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
1 1560
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: bhennon | last post by:
Hey all, I have a small php script that calls a random image at the following page. http://www.2006ymcanationals.com/random.php IT WORKS IF I go directly to the above link. I am trying to...
6
by: Stephane | last post by:
Hi, All images on my ASP.Net web site are reloaded almost each time I visit a page. My chache setting on IE is set to Automatically. When I visit another web site, images are rarely reloaded so...
3
by: rsteph | last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work. If I put text between the...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
7
by: Mariusf | last post by:
I am a novice Perl programmer and need to change a perl script that I use to create web pages with thumbnail images and some text. Currently the script created a web page for each artist / category...
2
by: OBAFGKM_RNS | last post by:
Let's say I have a Javascript function that loops over and over. In that function i have it alternating images on a button this way: if(var==0){ var myHTML = "<input type='button'...
1
by: bn4 | last post by:
I have been trying to modify a script that i had working in the past but have lost.. ORIGINAL URL: http://www.thescripts.com/forum/thread147097.html STEPS: I want it to do the following:...
5
by: kidders | last post by:
Below is a script i need to modify to work and its driving me nuts. Essentially it fades the content of an array. The original script specified the object name, I tried to modify it to allow an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.