Page 1 of 1
Star Sign
Posted: Mon Mar 24, 2003 9:32 pm
by ben
I want to create a script where people could type in their Date of Birth
and then there star sign would come up
Is this difficult and what is the process
Ben

hi there
Posted: Mon Mar 24, 2003 11:57 pm
by phpfreak
hi ben
i think this should help you, mail me if this is not what you want:
<html>
<head>
<script language="JavaScript">
function display_sign()
{
var month_entered=document.form1.monthnumber.value;
var signarray=new Array(12);
signarray[0]="Aries";
signarray[1]="Taurus";
signarray[2]="Gemini";
signarray[3]="Cancer";
signarray[4]="Leo";
signarray[5]="Virgo";
signarray[6]="Libra";
signarray[7]="Scorpio";
signarray[8]="Sagittarius";
signarray[9]="Capricorn";
signarray[10]="Aquarius";
signarray[11]="Pisces";
if((month_entered>0)&&(month_entered<=12))
{
for (count=0;count<12;count+=1)
{
if(count==month_entered-1)
{
document.write("Your sign is:"+ signarray[count]);
}
}
}
else
{
window.alert("please enter the month from 1 to 12");
document.form1.monthnumber.focus();
}
}
</script>
</head>
<body>
<form name="form1" onSubmit="display_sign();">
Month:<input type="text" name="monthnumber"><br>
<input type="submit" value="submit">
</form>
</body>
</html>
with regards
srinivas