Groups | Blog | Home
all groups > inetserver asp components > november 2004 >

inetserver asp components : Display different image between dates using ASP



DavidM
11/3/2004 3:25:39 PM
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.


Curt_C [MVP]
11/3/2004 3:39:06 PM
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


[quoted text, click to view]

DavidM
11/3/2004 3:45:56 PM
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..



[quoted text, click to view]

Curt_C [MVP]
11/3/2004 3:58:02 PM
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


[quoted text, click to view]

DavidM
11/3/2004 4:02:54 PM
What if I don't want to hardcode the year?


[quoted text, click to view]

Curt_C [MVP]
11/3/2004 4:11:14 PM
if Date > CDate("12/1/" & Year(Date)) and Date < CDate("12/31/" &
Year(Date)) then


--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


[quoted text, click to view]

Bob Barrows [MVP]
11/3/2004 5:15:13 PM
Or

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

[quoted text, click to view]

--
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
11/3/2004 6:44:10 PM
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.



[quoted text, click to view]

AddThis Social Bookmark Button