Display different image between dates using ASP

Discussion in 'ASP General' started by DavidM, Nov 3, 2004.

  1. DavidM

    DavidM Guest

    Hello -- I would like to display a different logo on my website for
    different seasons of the month.

    I currently have a logo for Halloween, Thanksgiving, and December.

    Can someone tell me what VBScript/ASP code I need to display an HTML image.

    Basically:
    1) any date from 10/01 thru 10/31 I would like to display the Halloween.
    2) any date between 11/01 - 11/30, I would like to display Thanksgiven.
    3) any date between 12/01 - 12/31, I would like to display the Christmas.

    Any help would be appreciated.
     
    DavidM, Nov 3, 2004
    #1
    1. Advertising

  2. DavidM

    DavidM Guest

    I understand that -- but a simple:

    If Date > 10/01 And Date < 10/31 Then
    Response.write "Display Logo1"
    Elese
    Response.write "Display Logo 2"
    End If

    Doesn't work..



    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:%...
    >a simple IF/THEN with Response.Write() will work if you dont store the info
    >in a DB.
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > Site: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "DavidM" <> wrote in message
    > news:...
    >> Hello -- I would like to display a different logo on my website for
    >> different seasons of the month.
    >>
    >> I currently have a logo for Halloween, Thanksgiving, and December.
    >>
    >> Can someone tell me what VBScript/ASP code I need to display an HTML
    >> image.
    >>
    >> Basically:
    >> 1) any date from 10/01 thru 10/31 I would like to display the Halloween.
    >> 2) any date between 11/01 - 11/30, I would like to display Thanksgiven.
    >> 3) any date between 12/01 - 12/31, I would like to display the Christmas.
    >>
    >> Any help would be appreciated.
    >>
    >>
    >>

    >
    >
     
    DavidM, Nov 3, 2004
    #2
    1. Advertising

  3. DavidM

    DavidM Guest

    What if I don't want to hardcode the year?


    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:%...
    > this works for me
    >
    > <%
    > if Date > "12/1/2004" and Date < "12/31/2004" then
    > response.write "yes"
    > else
    > response.write "no"
    > end if
    > %>
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > Site: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "DavidM" <> wrote in message
    > news:%...
    >>I understand that -- but a simple:
    >>
    >> If Date > 10/01 And Date < 10/31 Then
    >> Response.write "Display Logo1"
    >> Elese
    >> Response.write "Display Logo 2"
    >> End If
    >>
    >> Doesn't work..
    >>
    >>
    >>
    >> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    >> news:%...
    >>>a simple IF/THEN with Response.Write() will work if you dont store the
    >>>info in a DB.
    >>>
    >>> --
    >>> Curt Christianson
    >>> Owner/Lead Developer, DF-Software
    >>> Site: http://www.Darkfalz.com
    >>> Blog: http://blog.Darkfalz.com
    >>>
    >>>
    >>> "DavidM" <> wrote in message
    >>> news:...
    >>>> Hello -- I would like to display a different logo on my website for
    >>>> different seasons of the month.
    >>>>
    >>>> I currently have a logo for Halloween, Thanksgiving, and December.
    >>>>
    >>>> Can someone tell me what VBScript/ASP code I need to display an HTML
    >>>> image.
    >>>>
    >>>> Basically:
    >>>> 1) any date from 10/01 thru 10/31 I would like to display the
    >>>> Halloween.
    >>>> 2) any date between 11/01 - 11/30, I would like to display Thanksgiven.
    >>>> 3) any date between 12/01 - 12/31, I would like to display the
    >>>> Christmas.
    >>>>
    >>>> Any help would be appreciated.
    >>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    DavidM, Nov 3, 2004
    #3
  4. Or

    Select Case Month(date)
    Case 1
    Response.write "January"
    ....
    End Select

    DavidM wrote:
    > What if I don't want to hardcode the year?
    >
    >
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > news:%...
    >> this works for me
    >>
    >> <%
    >> if Date > "12/1/2004" and Date < "12/31/2004" then
    >> response.write "yes"
    >> else
    >> response.write "no"
    >> end if
    >> %>
    >>
    >> --
    >> Curt Christianson
    >> Owner/Lead Developer, DF-Software
    >> Site: http://www.Darkfalz.com
    >> Blog: http://blog.Darkfalz.com
    >>
    >>
    >> "DavidM" <> wrote in message
    >> news:%...
    >>> I understand that -- but a simple:
    >>>
    >>> If Date > 10/01 And Date < 10/31 Then
    >>> Response.write "Display Logo1"
    >>> Elese
    >>> Response.write "Display Logo 2"
    >>> End If
    >>>
    >>> Doesn't work..
    >>>
    >>>
    >>>
    >>> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    >>> news:%...
    >>>> a simple IF/THEN with Response.Write() will work if you dont store
    >>>> the info in a DB.
    >>>>
    >>>> --
    >>>> Curt Christianson
    >>>> Owner/Lead Developer, DF-Software
    >>>> Site: http://www.Darkfalz.com
    >>>> Blog: http://blog.Darkfalz.com
    >>>>
    >>>>
    >>>> "DavidM" <> wrote in message
    >>>> news:...
    >>>>> Hello -- I would like to display a different logo on my website
    >>>>> for different seasons of the month.
    >>>>>
    >>>>> I currently have a logo for Halloween, Thanksgiving, and December.
    >>>>>
    >>>>> Can someone tell me what VBScript/ASP code I need to display an
    >>>>> HTML image.
    >>>>>
    >>>>> Basically:
    >>>>> 1) any date from 10/01 thru 10/31 I would like to display the
    >>>>> Halloween.
    >>>>> 2) any date between 11/01 - 11/30, I would like to display
    >>>>> Thanksgiven. 3) any date between 12/01 - 12/31, I would like to
    >>>>> display the Christmas.
    >>>>>
    >>>>> Any help would be appreciated.


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Nov 3, 2004
    #4
  5. DavidM

    DavidM Guest

    Ahhh---such an elegant approach.

    I like this much better.

    strImage="logo_default.gif"
    Select Case Month(Date)
    Case 10
    strImage="logo_oct.gif"
    Case 11
    strImage="logo_nov.gif"
    Case 12
    strImage="logo_dec.gif"
    End Select

    Perfect and makes perfect sense.



    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > Or
    >
    > Select Case Month(date)
    > Case 1
    > Response.write "January"
    > ...
    > End Select
    >
    > DavidM wrote:
    >> What if I don't want to hardcode the year?
    >>
    >>
    >> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    >> news:%...
    >>> this works for me
    >>>
    >>> <%
    >>> if Date > "12/1/2004" and Date < "12/31/2004" then
    >>> response.write "yes"
    >>> else
    >>> response.write "no"
    >>> end if
    >>> %>
    >>>
    >>> --
    >>> Curt Christianson
    >>> Owner/Lead Developer, DF-Software
    >>> Site: http://www.Darkfalz.com
    >>> Blog: http://blog.Darkfalz.com
    >>>
    >>>
    >>> "DavidM" <> wrote in message
    >>> news:%...
    >>>> I understand that -- but a simple:
    >>>>
    >>>> If Date > 10/01 And Date < 10/31 Then
    >>>> Response.write "Display Logo1"
    >>>> Elese
    >>>> Response.write "Display Logo 2"
    >>>> End If
    >>>>
    >>>> Doesn't work..
    >>>>
    >>>>
    >>>>
    >>>> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    >>>> news:%...
    >>>>> a simple IF/THEN with Response.Write() will work if you dont store
    >>>>> the info in a DB.
    >>>>>
    >>>>> --
    >>>>> Curt Christianson
    >>>>> Owner/Lead Developer, DF-Software
    >>>>> Site: http://www.Darkfalz.com
    >>>>> Blog: http://blog.Darkfalz.com
    >>>>>
    >>>>>
    >>>>> "DavidM" <> wrote in message
    >>>>> news:...
    >>>>>> Hello -- I would like to display a different logo on my website
    >>>>>> for different seasons of the month.
    >>>>>>
    >>>>>> I currently have a logo for Halloween, Thanksgiving, and December.
    >>>>>>
    >>>>>> Can someone tell me what VBScript/ASP code I need to display an
    >>>>>> HTML image.
    >>>>>>
    >>>>>> Basically:
    >>>>>> 1) any date from 10/01 thru 10/31 I would like to display the
    >>>>>> Halloween.
    >>>>>> 2) any date between 11/01 - 11/30, I would like to display
    >>>>>> Thanksgiven. 3) any date between 12/01 - 12/31, I would like to
    >>>>>> display the Christmas.
    >>>>>>
    >>>>>> Any help would be appreciated.

    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
     
    DavidM, Nov 4, 2004
    #5
    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. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    893
    Rob Schieber
    Sep 30, 2005
  2. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    222
    Mark Schupp
    Aug 9, 2004
  3. Replies:
    1
    Views:
    228
    Jano Svitok
    Jul 17, 2007
  4. kellygreer1

    RFC-822 dates into Ruby dates

    kellygreer1, Jun 8, 2008, in forum: Ruby
    Replies:
    1
    Views:
    229
    Eric I.
    Jun 8, 2008
  5. Li Chen
    Replies:
    2
    Views:
    122
    Li Chen
    Mar 4, 2010
Loading...

Share This Page