Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Javascript


ghost's Avatar
0 0

can some of you plz help

ive gotta create a horocscope using javascript, however im stuck on where to start could u give me a lil push or a link for somewhere to help me

thanxs :)


ghost's Avatar
0 0

i'm not sure what u mean but this could be a simple thing…

<html> <title> thing </title> <body> <script language="javascript'>

var month=prompt("in what month is ur birthday?","");

if (month == january) { document.write("k"); } if (month == febuary) { document.write("ok"); }

</script> </body> </html>

I did NOT test this but you'd have to continue it out if that is what you mean. P.S. horoscope == like some sort of prediction?? English is not my mother langauge sorry.


ghost's Avatar
0 0

thanxs ill try and work from that

im ok at javascript but jsut not sure where to begin

and yeah its like tell u that ur star sign is cancer then give u a reading


ghost's Avatar
0 0

ezr1da971 wrote: i'm not sure what u mean but this could be a simple thing…

<html> <title> thing </title> <body> <script language="javascript'>

var month=prompt("in what month is ur birthday?","");

if (month == january) { document.write("k"); } if (month == febuary) { document.write("ok"); }

</script> </body> </html>

correct me if I'm wrong, but i think it would be: markupif (month == &quot;january&quot;) and so on..

you need the quotes around the month names to show that it's a literal string and not another variable that hasn't been declared yet.


ghost's Avatar
0 0

ive found this in some of my older work is there ne way i could change it so that it doesnt search for a golden number but looks for a certain date within a month like cancer = june 21 - july 20

<head> <title> </title> <script type="text/javascript">

var golden = 0; var birthdate = null; var planet = null; var reading = null; birthdate = prompt("Please enter your date of birth as a number DDMMYYYY","");

// do a simple check to see that the format is right

if (birthdate.length != 8 || isNaN(parseInt(birthdate))) { alert("Please type your date of birth as an 8 digit number"); exit; }

// calculate and tell them their golden number

golden = parseInt(birthdate) % 9; if (golden == 0) golden=9; document.write("Your golden number is "); document.write(golden);

// now tell them their ruling planet

switch (golden) { case 0 : planet = "Pluto"; break; case 1 : planet = "The Sun"; break; case 2 : planet = "The Moon"; break; case 3 : planet = "Jupiter"; break; case 4 : planet = "Mars"; break; case 5 : planet = "Mercury"; break; case 6 : planet = "Venus"; break; case 7 : planet = "Neptune"; break; case 8 : planet = "Saturn"; break; case 9 : planet = "Uranus"; break; default: planet = "Unknown"; break; }

// now tell them their reading

switch (golden) { case 0 : reading = ""; break; case 1 : reading = ""; break; case 2 : reading = " "; break; case 3 : reading = ""; break; case 4 : reading = ""; break; case 5 : reading = ""; break; case 6 : reading = ""; break; case 7 : reading = ""; break; case 8 : reading = ""; break; case 9 : reading = ""; break; }

document.write("<hr><br>Your ruling planet is "+planet); document.write("<hr><br>"+reading);

</script> <body> <hr> <br> All reading were taken from <a href="http://www.cainer.com">Cainer</a> </body> </head> </html>


ghost's Avatar
0 0

yes… yes you do need the quotes, I however, did not take the time to do that… I wrote it super quick


ghost's Avatar
0 0

markupif (golden == 0) golden=9;

And then you have a switch case for 0… it would never happen.


ghost's Avatar
0 0

so a lil update but still need help ive wrot e the script up however i need to add a readings for each of the star signs. im unsure about how to create a variable which is title reading but is link to one of ht star sign.

if possible could u answer as soon as possible :)

<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="2" bordercolor="00000" rules="none" cellspacing="0" cellpadding="4"> <!–DWLayoutTable–> <tr> <td height="32"><b><i>Year</i></b></td> <td width="126"><div align="right"> <input type="text" size="10" name="year" value="Birth Year" onClick=value=""> </div></td> <td> <!–This empty field is just for appearance–> </td> <tr> <td height="34"><b><i>Month</i></b></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> <!–This empty field is just for appearance–> </td> </tr> <tr> <td height="34"><b><i>Day</i></b></td> <td><div align="right"> <input type="text" name="date"value="Day" size="3" onClick=value=""></td> <td><input type="button" value="Calculate" onClick="signs()"></div> </td> </tr> <tr> <td height="32"><b><i>Sun Sign:</i></b></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"><b><i>Reading:</i></b> </td> <td colspan="2" rowspan="2" valign="top"><TEXTAREA NAME="reading" ROWS=10 COLS=32> </textarea></td> </tr> </table> </center> </form> </body> </html>