TagUK2006
07-08-2010, 09:39 AM
Hi Guys,
Just for fun I was trying to add some code to my pages to take a given date of birth and show the star sign along with an image.
It all seems to work except for 1 of the months December / CAPRICORN
Ive been a bit long winded with my code i think I should have used a select statment perhaps? but that aside the code i used to get all the other months are fine but dates for Capricorn dont show at all.
If anyone could pass their eye over my code and see whats up id be greatfull as ive sat with it for days and cant get it to display CAPRICORN. In the code i will paste ive substituded myDOB with a hardcoded date value as its fed with a var in my page.
The code is as follows
<div style="width:68%; float:left;height:165px; "><br />
<%
dim myDOB
myDOB=#31/12/2010#
%>
<%=myDOB%>
<br />
<br />
<span class="NormalGreyText"></span>
<%
Dim ARIESDate1,ARIESDate2
ARIESDate1 = #03/21/2002#
ARIESDate2 = #04/19/2002#
' Rebuild Dates to have the same year for comparison of months and days
ARIESDate1 =Day(ARIESDate1) & "/" & Month(ARIESDate1) & "/" & Year(myDOB)
ARIESDate2 =Day(ARIESDate2) & "/" & Month(ARIESDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(ARIESDate1) AND DateValue(myDOB) <= DateValue(ARIESDate2)Then
Response.Write "Im An Aries <br><br>"
%>
<img src="images/zodiac/aries.gif" width="50" height="50" />
<%
End If
%>
<%
Dim TAURUSDate1,TAURUSDate2
TAURUSDate1 = #04/20/2002#
TAURUSDate2 = #05/20/2002#
' Rebuild Dates to have the same year for comparison of months and days
TAURUSDate1 =Day(TAURUSDate1) & "/" & Month(TAURUSDate1) & "/" & Year(myDOB)
TAURUSDate2 =Day(TAURUSDate2) & "/" & Month(TAURUSDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(TAURUSDate1) AND DateValue(myDOB) <= DateValue(TAURUSDate2)Then
Response.Write "Im A TAURUS <br><br>"
%>
<img src="images/zodiac/tarus.gif" width="50" height="50" />
<%
End If
%>
<%
Dim GEMINIDate1,GEMINIDate2
GEMINIDate1 = #05/21/2002#
GEMINIDate2 = #06/20/2002#
' Rebuild Dates to have the same year for comparison of months and days
GEMINIDate1 =Day(GEMINIDate1) & "/" & Month(GEMINIDate1) & "/" & Year(myDOB)
GEMINIDate2 =Day(GEMINIDate2) & "/" & Month(GEMINIDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(GEMINIDate1) AND DateValue(myDOB) <= DateValue(GEMINIDate2)Then
Response.Write "Im A GEMINI <br><br>"
%>
<img src="images/zodiac/gemini.gif" width="50" height="50" />
<%
End If
%>
<%
Dim CANCERDate1,CANCERDate2
CANCERDate1 = #06/21/2002#
CANCERDate2 = #07/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
CANCERDate1 =Day(CANCERDate1) & "/" & Month(CANCERDate1) & "/" & Year(myDOB)
CANCERDate2 =Day(CANCERDate2) & "/" & Month(CANCERDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(CANCERDate1) AND DateValue(myDOB) <= DateValue(CANCERDate2)Then
Response.Write "Im A CANCER <br><br>"
%>
<img src="images/zodiac/cancer.gif" width="50" height="50" />
<%
End If
%>
<%
Dim LEODate1,LEODate2
LEODate1 = #07/23/2002#
LEODate2 = #08/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
LEODate1 =Day(LEODate1) & "/" & Month(LEODate1) & "/" & Year(myDOB)
LEODate2 =Day(LEODate2) & "/" & Month(LEODate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(LEODate1) AND DateValue(myDOB) <= DateValue(LEODate2)Then
Response.Write "Im A LEO <br><br>"
%>
<img src="images/zodiac/leo.gif" width="50" height="50" />
<%
End If
%>
<%
Dim VIRGODate1,VIRGODate2
VIRGODate1 = #08/23/2002#
VIRGODate2 = #09/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
VIRGODate1 =Day(VIRGODate1) & "/" & Month(VIRGODate1) & "/" & Year(myDOB)
VIRGODate2 =Day(VIRGODate2) & "/" & Month(VIRGODate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(VIRGODate1) AND DateValue(myDOB) <= DateValue(VIRGODate2)Then
Response.Write "Im A VIRGO <br><br>"
%>
<img src="images/zodiac/virgo.gif" width="50" height="50" />
<%
End If
%>
<%
Dim LIBRADate1,LIBRADate2
LIBRADate1 = #09/23/2002#
LIBRADate2 = #10/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
LIBRADate1 =Day(LIBRADate1) & "/" & Month(LIBRADate1) & "/" & Year(myDOB)
LIBRADate2 =Day(LIBRADate2) & "/" & Month(LIBRADate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(LIBRADate1) AND DateValue(myDOB) <= DateValue(LIBRADate2)Then
Response.Write "Im A LIBRA <br><br>"
%>
<img src="images/zodiac/libra.gif" width="50" height="50" />
<%
End If
%>
<%
Dim SCORPIODate1,SCORPIODate2
SCORPIODate1 = #10/23/2002#
SCORPIODate2 = #11/21/2002#
' Rebuild Dates to have the same year for comparison of months and days
SCORPIODate1 =Day(SCORPIODate1) & "/" & Month(SCORPIODate1) & "/" & Year(myDOB)
SCORPIODate2 =Day(SCORPIODate2) & "/" & Month(SCORPIODate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(SCORPIODate1) AND DateValue(myDOB) <= DateValue(SCORPIODate2)Then
Response.Write "Im A SCORPIO <br><br>"
%>
<img src="images/zodiac/scorpio.gif" width="50" height="50" />
<%
End If
%>
<%
Dim SAGITTARIUSDate1,SAGITTARIUSDate2
SAGITTARIUSDate1 = #11/22/2002#
SAGITTARIUSDate2 = #12/21/2002#
' Rebuild Dates to have the same year for comparison of months and days
SAGITTARIUSDate1 =Day(SAGITTARIUSDate1) & "/" & Month(SAGITTARIUSDate1) & "/" & Year(myDOB)
SAGITTARIUSDate2 =Day(SAGITTARIUSDate2) & "/" & Month(SAGITTARIUSDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(SAGITTARIUSDate1) AND DateValue(myDOB) <= DateValue(SAGITTARIUSDate2)Then
Response.Write "Im A SAGITTARIUS <br><br>"
%>
<img src="images/zodiac/sagitarius.gif" width="50" height="50" />
<%
End If
%>
<%
Dim CAPRICORNDate1,CAPRICORNDate2
CAPRICORNDate1 = #12/22/2002#
CAPRICORNDate2 = #01/19/2003#
' Rebuild Dates to have the same year for comparison of months and days DECEMBER
CAPRICORNDate1 =Day(CAPRICORNDate1) & "/" & Month(CAPRICORNDate1) & "/" & Year(myDOB)
CAPRICORNDate2 =Day(CAPRICORNDate2) & "/" & Month(CAPRICORNDate2) & "/" & Year(myDOB )
If DateValue(myDOB) >= DateValue(CAPRICORNDate1) AND DateValue(myDOB) <= DateValue(CAPRICORNDate2)Then
Response.Write "Im A CAPRICORN <br><br>"
%>
<img src="images/zodiac/capricorn.gif" width="50" height="50" />
<%
End If
%>
<%
Dim AQUARIUSDate1,AQUARIUSDate2
AQUARIUSDate1 = #01/20/2003#
AQUARIUSDate2 = #02/18/2003#
' Rebuild Dates to have the same year for comparison of months and days
AQUARIUSDate1 =Day(AQUARIUSDate1) & "/" & Month(AQUARIUSDate1) & "/" & Year(myDOB)
AQUARIUSDate2 =Day(AQUARIUSDate2) & "/" & Month(AQUARIUSDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(AQUARIUSDate1) AND DateValue(myDOB) <= DateValue(AQUARIUSDate2)Then
Response.Write "Im A AQUARIUS <br><br>"
%>
<img src="images/zodiac/aquarius.gif" width="50" height="50" />
<%
End If
%>
<%
Dim PISCESDate1,PISCESDate2
PISCESDate1 = #02/19/2002#
PISCESDate2 = #03/20/2002#
' Rebuild Dates to have the same year for comparison of months and days
PISCESDate1 =Day(PISCESDate1) & "/" & Month(PISCESDate1) & "/" & Year(myDOB)
PISCESDate2 =Day(PISCESDate2) & "/" & Month(PISCESDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(PISCESDate1) AND DateValue(myDOB) <= DateValue(PISCESDate2)Then
Response.Write "Im A PISCES <br><br>"
%>
<img src="images/zodiac/picies.gif" width="50" height="50" />
<%
End If
%>
</div>
Just for fun I was trying to add some code to my pages to take a given date of birth and show the star sign along with an image.
It all seems to work except for 1 of the months December / CAPRICORN
Ive been a bit long winded with my code i think I should have used a select statment perhaps? but that aside the code i used to get all the other months are fine but dates for Capricorn dont show at all.
If anyone could pass their eye over my code and see whats up id be greatfull as ive sat with it for days and cant get it to display CAPRICORN. In the code i will paste ive substituded myDOB with a hardcoded date value as its fed with a var in my page.
The code is as follows
<div style="width:68%; float:left;height:165px; "><br />
<%
dim myDOB
myDOB=#31/12/2010#
%>
<%=myDOB%>
<br />
<br />
<span class="NormalGreyText"></span>
<%
Dim ARIESDate1,ARIESDate2
ARIESDate1 = #03/21/2002#
ARIESDate2 = #04/19/2002#
' Rebuild Dates to have the same year for comparison of months and days
ARIESDate1 =Day(ARIESDate1) & "/" & Month(ARIESDate1) & "/" & Year(myDOB)
ARIESDate2 =Day(ARIESDate2) & "/" & Month(ARIESDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(ARIESDate1) AND DateValue(myDOB) <= DateValue(ARIESDate2)Then
Response.Write "Im An Aries <br><br>"
%>
<img src="images/zodiac/aries.gif" width="50" height="50" />
<%
End If
%>
<%
Dim TAURUSDate1,TAURUSDate2
TAURUSDate1 = #04/20/2002#
TAURUSDate2 = #05/20/2002#
' Rebuild Dates to have the same year for comparison of months and days
TAURUSDate1 =Day(TAURUSDate1) & "/" & Month(TAURUSDate1) & "/" & Year(myDOB)
TAURUSDate2 =Day(TAURUSDate2) & "/" & Month(TAURUSDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(TAURUSDate1) AND DateValue(myDOB) <= DateValue(TAURUSDate2)Then
Response.Write "Im A TAURUS <br><br>"
%>
<img src="images/zodiac/tarus.gif" width="50" height="50" />
<%
End If
%>
<%
Dim GEMINIDate1,GEMINIDate2
GEMINIDate1 = #05/21/2002#
GEMINIDate2 = #06/20/2002#
' Rebuild Dates to have the same year for comparison of months and days
GEMINIDate1 =Day(GEMINIDate1) & "/" & Month(GEMINIDate1) & "/" & Year(myDOB)
GEMINIDate2 =Day(GEMINIDate2) & "/" & Month(GEMINIDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(GEMINIDate1) AND DateValue(myDOB) <= DateValue(GEMINIDate2)Then
Response.Write "Im A GEMINI <br><br>"
%>
<img src="images/zodiac/gemini.gif" width="50" height="50" />
<%
End If
%>
<%
Dim CANCERDate1,CANCERDate2
CANCERDate1 = #06/21/2002#
CANCERDate2 = #07/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
CANCERDate1 =Day(CANCERDate1) & "/" & Month(CANCERDate1) & "/" & Year(myDOB)
CANCERDate2 =Day(CANCERDate2) & "/" & Month(CANCERDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(CANCERDate1) AND DateValue(myDOB) <= DateValue(CANCERDate2)Then
Response.Write "Im A CANCER <br><br>"
%>
<img src="images/zodiac/cancer.gif" width="50" height="50" />
<%
End If
%>
<%
Dim LEODate1,LEODate2
LEODate1 = #07/23/2002#
LEODate2 = #08/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
LEODate1 =Day(LEODate1) & "/" & Month(LEODate1) & "/" & Year(myDOB)
LEODate2 =Day(LEODate2) & "/" & Month(LEODate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(LEODate1) AND DateValue(myDOB) <= DateValue(LEODate2)Then
Response.Write "Im A LEO <br><br>"
%>
<img src="images/zodiac/leo.gif" width="50" height="50" />
<%
End If
%>
<%
Dim VIRGODate1,VIRGODate2
VIRGODate1 = #08/23/2002#
VIRGODate2 = #09/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
VIRGODate1 =Day(VIRGODate1) & "/" & Month(VIRGODate1) & "/" & Year(myDOB)
VIRGODate2 =Day(VIRGODate2) & "/" & Month(VIRGODate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(VIRGODate1) AND DateValue(myDOB) <= DateValue(VIRGODate2)Then
Response.Write "Im A VIRGO <br><br>"
%>
<img src="images/zodiac/virgo.gif" width="50" height="50" />
<%
End If
%>
<%
Dim LIBRADate1,LIBRADate2
LIBRADate1 = #09/23/2002#
LIBRADate2 = #10/22/2002#
' Rebuild Dates to have the same year for comparison of months and days
LIBRADate1 =Day(LIBRADate1) & "/" & Month(LIBRADate1) & "/" & Year(myDOB)
LIBRADate2 =Day(LIBRADate2) & "/" & Month(LIBRADate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(LIBRADate1) AND DateValue(myDOB) <= DateValue(LIBRADate2)Then
Response.Write "Im A LIBRA <br><br>"
%>
<img src="images/zodiac/libra.gif" width="50" height="50" />
<%
End If
%>
<%
Dim SCORPIODate1,SCORPIODate2
SCORPIODate1 = #10/23/2002#
SCORPIODate2 = #11/21/2002#
' Rebuild Dates to have the same year for comparison of months and days
SCORPIODate1 =Day(SCORPIODate1) & "/" & Month(SCORPIODate1) & "/" & Year(myDOB)
SCORPIODate2 =Day(SCORPIODate2) & "/" & Month(SCORPIODate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(SCORPIODate1) AND DateValue(myDOB) <= DateValue(SCORPIODate2)Then
Response.Write "Im A SCORPIO <br><br>"
%>
<img src="images/zodiac/scorpio.gif" width="50" height="50" />
<%
End If
%>
<%
Dim SAGITTARIUSDate1,SAGITTARIUSDate2
SAGITTARIUSDate1 = #11/22/2002#
SAGITTARIUSDate2 = #12/21/2002#
' Rebuild Dates to have the same year for comparison of months and days
SAGITTARIUSDate1 =Day(SAGITTARIUSDate1) & "/" & Month(SAGITTARIUSDate1) & "/" & Year(myDOB)
SAGITTARIUSDate2 =Day(SAGITTARIUSDate2) & "/" & Month(SAGITTARIUSDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(SAGITTARIUSDate1) AND DateValue(myDOB) <= DateValue(SAGITTARIUSDate2)Then
Response.Write "Im A SAGITTARIUS <br><br>"
%>
<img src="images/zodiac/sagitarius.gif" width="50" height="50" />
<%
End If
%>
<%
Dim CAPRICORNDate1,CAPRICORNDate2
CAPRICORNDate1 = #12/22/2002#
CAPRICORNDate2 = #01/19/2003#
' Rebuild Dates to have the same year for comparison of months and days DECEMBER
CAPRICORNDate1 =Day(CAPRICORNDate1) & "/" & Month(CAPRICORNDate1) & "/" & Year(myDOB)
CAPRICORNDate2 =Day(CAPRICORNDate2) & "/" & Month(CAPRICORNDate2) & "/" & Year(myDOB )
If DateValue(myDOB) >= DateValue(CAPRICORNDate1) AND DateValue(myDOB) <= DateValue(CAPRICORNDate2)Then
Response.Write "Im A CAPRICORN <br><br>"
%>
<img src="images/zodiac/capricorn.gif" width="50" height="50" />
<%
End If
%>
<%
Dim AQUARIUSDate1,AQUARIUSDate2
AQUARIUSDate1 = #01/20/2003#
AQUARIUSDate2 = #02/18/2003#
' Rebuild Dates to have the same year for comparison of months and days
AQUARIUSDate1 =Day(AQUARIUSDate1) & "/" & Month(AQUARIUSDate1) & "/" & Year(myDOB)
AQUARIUSDate2 =Day(AQUARIUSDate2) & "/" & Month(AQUARIUSDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(AQUARIUSDate1) AND DateValue(myDOB) <= DateValue(AQUARIUSDate2)Then
Response.Write "Im A AQUARIUS <br><br>"
%>
<img src="images/zodiac/aquarius.gif" width="50" height="50" />
<%
End If
%>
<%
Dim PISCESDate1,PISCESDate2
PISCESDate1 = #02/19/2002#
PISCESDate2 = #03/20/2002#
' Rebuild Dates to have the same year for comparison of months and days
PISCESDate1 =Day(PISCESDate1) & "/" & Month(PISCESDate1) & "/" & Year(myDOB)
PISCESDate2 =Day(PISCESDate2) & "/" & Month(PISCESDate2) & "/" & Year(myDOB)
If DateValue(myDOB) >= DateValue(PISCESDate1) AND DateValue(myDOB) <= DateValue(PISCESDate2)Then
Response.Write "Im A PISCES <br><br>"
%>
<img src="images/zodiac/picies.gif" width="50" height="50" />
<%
End If
%>
</div>