On This Date...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Lund

    #1

    On This Date...

    How does one write JavaScript code for an image of something that happened
    or appeared on this date? For example, today (as I'm writing this) is
    October 2nd, and I would like to have an image of something that happened on
    October 2nd.


    -- John Lund


  • Evertjan.

    #2
    Re: On This Date...

    "John Lund" <johnlund@jml19 65.com> wrote in
    news:_E3fb.1826 7$yU5.3689@nwrd ny01.gnilink.ne t:
    [color=blue]
    > How does one write JavaScript code for an image of something that
    > happened or appeared on this date? For example, today (as I'm writing
    > this) is October 2nd, and I would like to have an image of something
    > that happened on October 2nd.
    >[/color]


    <script>
    function two(x) {return ((x>9)?"":"0")+ x}
    d = new Date();
    img = "happened"+two( getMonth(d)+1)+ two(getDate(d)) +".jpg"
    document.write( "<img src='"+img+"'>" )
    // This shows the image "happened1002.j pg" on your date
    </script>

    not tested!

    Comment

    Working...