littledigger
12-06-2012, 12:45 PM
Guys, really need help with this
Need to get the following to output into something like this
<img src="http://jakebui.com/whatthefrellareyoudoingareyoufarbot/wp-content/uploads/2012/12/zodiac.png">
Conditions:
Must be able to covert the month string into a number and calculate the todays to minus birthdate and output as total days
<html>
<head>
<title>CSC1401 - Assignment 1, Chinese Zodiac</title>
<script>
var year=prompt('Enter your year of birth as a 4-digit integer', '1981');
var month=prompt('Enter your month of birth', 'Apr');
var day=prompt('Enter your day of birth as an integer', '19');
var yearsPassed=((year)-1924);
var today=new Date(); //today's date
var birthday=(day + month + year);
var daysAlive=((today.getTime()-birthday.getTime())/millisecInDay);//converting milliseconds alive to days
var zodiacYear=((year-INITIAL_YEAR));
var millisecInDay=1000*60*60*24;
//variables and constants defined.
//Birthday now entered.
var zodiacSign=new Array('rat','ox','tiger','rabbit','dragon','snake','horse','goat','monkey','rooster','dog','pig');
birthmonth=(JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC);
birthmonth=birthmonth.toUpperCase();
ZODIAC_CYCLE=12;
INITIAL_YEAR=1924;
</script>
</head>
<body>
<h1>Chinese Zodiac</h1>
<hr/>
<ul>
<li><h2>Your birthday is <font color="#ff0000"><script>document.write(day + " " + month + " " + year + ".")</script></font></h2></li>
<li><h2>You have been alive for <font color="#3300ff"> <script>document.write(birthday)</script></font> days.</h2></li>
<li><h2>Your Chinese Zodiac animal is:</h2></li>
<img src="rat.jpg"/>
<img src="ox.jpg"/>
<script>
if (zodiacYear%12==0) <img src="rat.jpg"/>
else if (zodiacYear%12==1) <img src="ox.jpg"/>
else if (zodiacYear%12==2) /* COMMENT */
else if (zodiacYear%12==3) //COMMENTS
else if (zodiacYear%12==4)
else if (zodiacYear%12==5)
else if (zodiacYear%12==6)
else if (zodiacYear%12==7)
else if (zodiacYear%12==8)
else if (zodiacYear%12==9)
else if (zodiacYear%12==10)
else if (zodiacYear%12==11)
</script>
<p>Thanks to <a href="http://FreeDigitalPhotos.net">Free Digital Photos.net</a> for providing the images for free educational use.<p/>
</body>
</html>
Need to get the following to output into something like this
<img src="http://jakebui.com/whatthefrellareyoudoingareyoufarbot/wp-content/uploads/2012/12/zodiac.png">
Conditions:
Must be able to covert the month string into a number and calculate the todays to minus birthdate and output as total days
<html>
<head>
<title>CSC1401 - Assignment 1, Chinese Zodiac</title>
<script>
var year=prompt('Enter your year of birth as a 4-digit integer', '1981');
var month=prompt('Enter your month of birth', 'Apr');
var day=prompt('Enter your day of birth as an integer', '19');
var yearsPassed=((year)-1924);
var today=new Date(); //today's date
var birthday=(day + month + year);
var daysAlive=((today.getTime()-birthday.getTime())/millisecInDay);//converting milliseconds alive to days
var zodiacYear=((year-INITIAL_YEAR));
var millisecInDay=1000*60*60*24;
//variables and constants defined.
//Birthday now entered.
var zodiacSign=new Array('rat','ox','tiger','rabbit','dragon','snake','horse','goat','monkey','rooster','dog','pig');
birthmonth=(JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC);
birthmonth=birthmonth.toUpperCase();
ZODIAC_CYCLE=12;
INITIAL_YEAR=1924;
</script>
</head>
<body>
<h1>Chinese Zodiac</h1>
<hr/>
<ul>
<li><h2>Your birthday is <font color="#ff0000"><script>document.write(day + " " + month + " " + year + ".")</script></font></h2></li>
<li><h2>You have been alive for <font color="#3300ff"> <script>document.write(birthday)</script></font> days.</h2></li>
<li><h2>Your Chinese Zodiac animal is:</h2></li>
<img src="rat.jpg"/>
<img src="ox.jpg"/>
<script>
if (zodiacYear%12==0) <img src="rat.jpg"/>
else if (zodiacYear%12==1) <img src="ox.jpg"/>
else if (zodiacYear%12==2) /* COMMENT */
else if (zodiacYear%12==3) //COMMENTS
else if (zodiacYear%12==4)
else if (zodiacYear%12==5)
else if (zodiacYear%12==6)
else if (zodiacYear%12==7)
else if (zodiacYear%12==8)
else if (zodiacYear%12==9)
else if (zodiacYear%12==10)
else if (zodiacYear%12==11)
</script>
<p>Thanks to <a href="http://FreeDigitalPhotos.net">Free Digital Photos.net</a> for providing the images for free educational use.<p/>
</body>
</html>