Script to change images with each visit

Discussion in 'Javascript' started by ross, Jan 25, 2006.

  1. ross

    ross Guest

    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>
    ross, Jan 25, 2006
    #1
    1. Advertising

  2. ross

    ross Guest

    Figured it out, Thanks, though, Dick Ross


    "ross" <> wrote in message
    news:58c3$43d7d0fb$40971e23$...
    >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>
    >
    >
    ross, Jan 25, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. xerj
    Replies:
    4
    Views:
    350
  2. Jonas Auken
    Replies:
    1
    Views:
    1,772
    Steven Cheng[MSFT]
    Oct 12, 2004
  3. Honey

    please visit my website!

    Honey, Jun 10, 2004, in forum: Java
    Replies:
    0
    Views:
    360
    Honey
    Jun 10, 2004
  4. Replies:
    2
    Views:
    79
    Austin Ziegler
    Jul 7, 2006
  5. vj
    Replies:
    3
    Views:
    238
Loading...

Share This Page