Display Day of Week as an Image
- Home
- Javascript
- Display Day of Week as an Image
Dispaly the Date and the Day of the week. Date as Text,
Day of Week as an Image.
This was orginally done in Javascript.. but as you can see there is a problem with the year. Below is the ASP version, done in about 1/2 the lines of code.
View the source of the page for the Javascript.. here is the ASP:
<% 'Do it in ASP
m = MonthName(Month(Date))
d = Day(Date)
y = Year(Date)
wd = WeekDay(Date)
Select Case wd
Case 1
img = "images/sunday.jpg"
Case 2
img = "images/monday.jpg"
Case 3
img = "images/tuesday.jpg"
Case 4
img = "images/wednesday.jpg"
Case 5
img = "images/thursday.jpg"
Case 6
img = "images/friday.jpg"
Case 7
img = "images/saturday.jpg"
End Select
' Show it
Response.Write "<TABLE WIDTH=""120"" BORDER=""0"" CELLSPACING=""2"" CELLPADDING=""0"" HEIGHT=""34"">"
Response.Write "<tr>"
Response.Write "<TD WIDTH=""120"" HEIGHT=""34"" ALIGN=""center"" VALIGN=""bottom"" BACKGROUND=""" & img & """>"
Response.Write "<CENTER><FONT COLOR=""#003399"" FACE=""Arial"" SIZE=""-1"">" & m & " " & d & ", " & y & _
"</font></center></td></tr></table>"
%>
date and time javascript day as an image