Auto CHANGE AN IMAGE every day of the week

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • davidundalicia
    General

    • Mar 2006
    • 6294

    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>
    Have fun
    Regards..... David

    Step by Step Visual Tutorials for the complete beginner
    Newbies / Beginners Forum
    FREE Membership Login Scripts: - Meta Tags Analyzer
    My Social Networking Site - Free Contact Forms
    Finished your New website!! Now get it noticed Here:
  • Marincky
    General

    • Apr 2006
    • 4539

    #2
    Re: Auto Change an image every day of the week

    Nice tip David
    Don't aim for success if you want it; just do what you love and believe in, and it will come naturally.

    Comment

    • musc3
      Sergeant First Class

      • Jan 2009
      • 50

      #3
      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 .

      Comment

      • Watdaflip
        Major General

        • Sep 2005
        • 2116

        #4
        Re: Auto CHANGE AN IMAGE every day of the week

        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

        Comment

        • musc3
          Sergeant First Class

          • Jan 2009
          • 50

          #5
          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.

          Comment

          • Lisa-1111
            Private

            • Aug 2009
            • 1

            #6
            Re: Auto CHANGE AN IMAGE every day of the week

            Can I make the images a link?

            Comment

            • rivast
              Special Status

              • Aug 2009
              • 77

              #7
              Re: Auto CHANGE AN IMAGE every day of the week

              Hey David great tip!
              Thanks!

              Richard

              Comment

              Working...
              X