Results 1 to 7 of 7

Thread: Auto CHANGE AN IMAGE every day of the week
      
   

  1. #1
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,294

    Default Auto CHANGE AN IMAGE every day of the week

    Here is a small usefull free script that I picked up on my travels..............

    upload the required 7 different images named:

    sunday.jpg
    monday.jpg
    tuesday.jpg
    wednesday.jpg
    thursday.jpg
    friday.jpg
    saturday.jpg

    Then Just copy and paste the script below into a Bluevoda HTML box
    Size and place where required on your page:


    <SCRIPT LANGUAGE="JavaScript">

    <!-- This script and many more are available free online at -->
    <!-- Rainbow Arch: http://rainbow.arch.scriptmania.com -->

    <!-- Begin
    today = new Date();
    day = today.getDay();
    arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg",
    "wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");

    document.write("<img src='" + arday[day] + "'>");
    // End -->
    </SCRIPT>

  2. #2
    Join Date
    Apr 2006
    Location
    Warwickshire, UK
    Posts
    4,539

    Default Re: Auto Change an image every day of the week

    Nice tip David

  3. #3
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    50

    Default Re: Auto CHANGE AN IMAGE every day of the week

    Hi David,if i wanted to change and image every 12 hours for 30 days,would i change the code to
    <!-- Begin
    today = new Date();
    day = today.getDay();
    arday = new Array("sunday12am.jpg","sunday12pm.jpg", "monday.jpg", "tuesday.jpg",
    "wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");

    document.write("<img src='" + arday[day] + "'>");
    // End -->
    </SCRIPT> would i continue doing that for every day of the month,or it would be totally be diffrent. thks in advance .

  4. #4
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,116

    Default Re: Auto CHANGE AN IMAGE every day of the week

    Quote Originally Posted by musc3 View Post
    Hi David,if i wanted to change and image every 12 hours for 30 days,would i change the code to
    <!-- Begin
    today = new Date();
    day = today.getDay();
    arday = new Array("sunday12am.jpg","sunday12pm.jpg", "monday.jpg", "tuesday.jpg",
    "wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");

    document.write("<img src='" + arday[day] + "'>");
    // End -->
    </SCRIPT> would i continue doing that for every day of the month,or it would be totally be diffrent. thks in advance .
    No, you would do something like:

    Code:
    <script language="javascript">
    <!-- Begin
    var today = new Date();
    var day = today.getDay();
    var hour = today.getHours();
    var daysAM = new Array("sundayAM.jpg", "mondayAM.jpg", "tuesdayAM.jpg", "wednesdayAM.jpg", "thursdayAM.jpg", "fridayAM.jpg", "saturdayAM.jpg");
    var daysPM = new Array("sundayPM.jpg", "mondayPM.jpg", "tuesdayPM.jpg", "wednesdayPM.jpg", "thursdayPM.jpg", "fridayPM.jpg", "saturdayPM.jpg");
    
    if(hour < 12)
         document.write('<img src="' + daysAM[day] + '" />');
    else
         document.write('<img src="' + daysPM[day] + '" />');
    //  End -->
    </script>
    bear in mind I didn't test this, but assuming I didn't make a typos it should work.

    You also would need to create the two images, ie.. sundayAM.jpg and sundayPM.jpg, for each day of the week. The name of the images can be changed but make sure you change it in the corresponding name in the javascript

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  5. #5
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    50

    Default Re: Auto CHANGE AN IMAGE every day of the week

    Hi ...thks watda...wow coding is really difficulte and so confusing..i was wayyyyyyyyyy off on that one....thks again your a life savior.

  6. #6
    Join Date
    Aug 2009
    Posts
    1

    Default Re: Auto CHANGE AN IMAGE every day of the week

    Can I make the images a link?

  7. #7
    Join Date
    Aug 2009
    Location
    the Netherlands
    Posts
    77

    Talking Re: Auto CHANGE AN IMAGE every day of the week

    Hey David great tip!
    Thanks!

    Richard

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •