Results 1 to 3 of 3

Thread: Image According to the day

  1. #1
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Image According to the day

    I'm trying to find a script of some sort that shows an image according to the date(ie on the 1st, 2nd, 3rd, etc of each month) and also one that can show an image according to the month. I want to put the date up on my website but I want to do it by image so I can control how it looks. If anyone knows something that could do this, that would be great! Thank you in advance!

    -Ian

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    In about the simplest terms, you could have something like so:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    </head>
    <body>
    <script type="text/javascript">
    ;(function(){
    var d = new Date();
    document.write('<img src="mo_' + d.getMonth() + '.gif"><img src="day_' + d.getDate() + '.gif">');
    })();
    </script>
    </body>
    </html>
    This would allow you to have month images:

    mo_0.gif

    through:

    mo_11.gif

    for Jan (0) through Dec. (11). And day images:

    day_1.gif

    through

    day_31.gif

    for each possible date of the month (1 to 31).
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Cool, thanks, simple is much better for me than highly complicated. And actually? I actually understand this script and how it works!(i usually don't understand them, I just use them) Thanks!

    -Ian

Bookmarks

Posting Permissions

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