If ever there was a time of dire need..., Well, now wouldn't be it. -shrug- |
If ever there was a time of dire need..., Well, now wouldn't be it. -shrug- |
May 13 2006, 03:13 PM
Post
#1
|
|
![]() You'll find me in your dreams. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 8,536 Joined: Mar 2005 Member No: 114,010 |
Wanna help Reili do her homework? Okay.
[ http://www.blewmyallowanceonmanga.net/ribb...ssigned/npn.htm ] Now, explain why my Javascript isn't working. Please. CODE <script type="text/javascript"> ^ That's in the HTML file. Then there's library.js:<!-- hiding from non-javascript browsers var Today=new Date("October 15, 2006"); var ThisDay=Today.getDate(); var ThisMonth=Today.getMonth()+1; var ThisYear=Today.getFullYear(); var DaysLeft=XmasDays(Today); document.write("Today is "+ ThisMonth +"/"+ ThisDay +"/"+ ThisYear +"<br />"); if (DaysLeft > 0) { document.write("Only "+ DaysLeft +" left until Christmas!"); } else { document.write("Happy Holidays from North Pole Novelties!"); } // stop hiding --> </script> CODE /* Function: XmasDays() Before I added the above function and the following section of code:Purpose: Calcute difference between Christmas& a given date. Variables: CheckDay: A date object containing the given date. XYear: The four-digit year value of the given date. XDay: December 25 in the year of the given date. DayCount: The number of days between Christmas and the given date. */ function XmasDays(CheckDay) { var XYear=CheckDay.getFullYear(); var XDay=new date("December 25, 2006"); XDay.setFullYear(XYear); var DayCount=(XDay-CheckDay)/(1000*60*60*24); DayCount=Math.round(DayCount); return DayCount; } CODE if (DaysLeft > 0) { It worked. So I'm guessing I screwed up royally somewhere and I just don't see it. Or the book I was working out of screwed up. Either way.document.write("Only "+ DaysLeft +" left until Christmas!"); } else { document.write("Happy Holidays from North Pole Novelties!"); } To get really technical, I know what the problem is. Something, something "XmasDays not defined"&something, something "Date not defined". Translate? |
|
|
|
fishcake-y If ever there was a time of dire need... May 13 2006, 03:13 PM
mipadi Well, one thing I can suggest is that, as far as I... May 18 2006, 08:24 AM
fishcake-y Err.... Yeah... All I was doing was coping outta m... May 18 2006, 08:27 PM![]() ![]() |