Generate text based on date of birth

This is a discussion on "Generate text based on date of birth" within the JavaScript Forum section. This forum, and the thread "Generate text based on date of birth are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 27th, 2007, 11:01
New Member
Join Date: Apr 2007
Location: England
Age: 25
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Generate text based on date of birth

Hi all, I'm getting to grips with Javascript for the first time at the moment and wondered if you'd be able to help me. I have the script below to work out what someone's star sign is from their date of birth, but I'd also like it to generate some text as a kind of horoscope reading. I'm sure it will quite easy but for some reason whatever I try doesn't work!

Any assistance greatly appreciated,

Thanks, T
Code: Select all
<HEAD>
<script LANGUAGE="Javascript">
function signs() {
var start = 1901, birthyear = document.zodiac.year.value, date=document.zodiac.date.value, month=document.zodiac.month.selectedIndex;
with (document.zodiac.sign){
if (month == 1 && date >=20 || month == 2 && date <=18) {value = "Aquarius";}
if (month == 1 && date > 31) {value = "Invalid Date";}
if (month == 2 && date >=19 || month == 3 && date <=20) {value = "Pisces";}
if (month == 2 && date > 29) {value = "Invalid Date";}
if (month == 3 && date >=21 || month == 4 && date <=19) {value = "Aries";}
if (month == 3 && date > 31) {value = "Invalid Date";}
if (month == 4 && date >=20 || month == 5 && date <=20) {value = "Taurus";}
if (month == 4 && date > 30) {value = "Invalid Date";}
if (month == 5 && date >=21 || month == 6 && date <=21) {value = "Gemini";}
if (month == 5 && date > 31) {value = "Invalid Date";}
if (month == 6 && date >=22 || month == 7 && date <=22) {value = "Cancer";}
if (month == 6 && date > 30) {value = "Invalid Date";}
if (month == 7 && date >=23 || month == 8 && date <=22) {value = "Leo";}
if (month == 7 && date > 31) {value = "Invalid Date";}
if (month == 8 && date >=23 || month == 9 && date <=22) {value = "Virgo";}
if (month == 8 && date > 31) {value = "Invalid Date";}
if (month == 9 && date >=23 || month == 10 && date <=22) {value = "Libra";}
if (month == 9 && date > 30) {value = "Invalid Date";}
if (month == 10 && date >=23 || month == 11 && date <=21) {value = "Scorpio";}
if (month == 10 && date > 31) {value = "Invalid Date";}
if (month == 11 && date >=22 || month == 12 && date <=21) {value = "Sagittarius";}
if (month == 11 && date > 30) {value = "Invalid Date";}
if (month == 12 && date >=22 || month == 1 && date <=19) {value = "Capricorn";}
if (month == 12 && date > 31) {value = "Invalid Date";}
}
 
}
// End -->
</script>
</HEAD>
 
<BODY>
<form name="zodiac">
<center>
<table border="5" bordercolor="00000" rules="none" cellspacing="0" cellpadding="4">
<!--DWLayoutTable-->
<tr> 
<td height="32">Year</td>
<td width="126"><div align="right"> 
<input type="text" size="10" name="year" value="Birth Year" onclick=value="">
</div></td>
<td> 
</td>
<tr> 
<td height="34">Month</td>
<td><div align="right"> 
<select name="month">
<option value="x">Select Birth Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
</div></td>
<td> 
</td>
</tr>
<tr> 
<td height="34">Day</td>
<td><div align="right"> <input type="text" name="date"value="Day" size="3" onclick=value=""></td>
<td><input type="button" value="Get Reading" onclick="signs()"></div>
</td>
</tr>
<tr> 
<td height="32">Zodiac Sign:</td>
<td valign="top"><div align="right"> 
<input type="text" name="sign" size="12" value="" align="right">
</div></td>
<td width="136"> </td>
</tr>
<tr>
<td height="29">Reading:</td>
<td colspan="2" rowspan="2" valign="top"><TEXTAREA NAME="reading" ROWS=10 COLS=32>
</textarea></td>
</tr>
</table>
</center>
</form>
</body>
</html>

Last edited by karinne; Apr 27th, 2007 at 12:22. Reason: Please use [code]...[/code] tags when displaying code!

  #2 (permalink)  
Old Oct 27th, 2007, 02:24
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Generate text based on date of birth

Hello. Have you solved this yet? I see that you posted it in April this year. If not, I think I can help you.

SWagner
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
  #3 (permalink)  
Old Oct 27th, 2007, 10:29
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: Generate text based on date of birth

Doubt the member will see this - his/her's last visit was february.
  #4 (permalink)  
Old Oct 27th, 2007, 11:00
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: Generate text based on date of birth

I think this is no longer actual.

CLOSED
Closed Thread

Tags
javascript

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show/Hide text fields based on drop down sing2trees JavaScript Forum 1 Apr 22nd, 2008 21:01
text based slide show skat ASP.NET Forum 4 Apr 7th, 2008 22:23
can't convert table-based to css-based layout markus Web Page Design 21 Apr 25th, 2007 22:50
Changing date format in date picker AdRock JavaScript Forum 1 Aug 1st, 2006 17:16


All times are GMT. The time now is 10:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43