Thread: Html Calendar
View Single Post
Old 14-10-2006, 04:52 PM   #2
Rinforzando
Forum hobbit

 
Join Date: Jun 2005
Location: Bicester, England
Posts: 45
Default

[attachmentid=3762]
Voila! I think I have solved your problems. I would have prefered to have explained to you what you needed to do, but it seemed easier to just do it. I'll quickly go through the changes I've made.
  1. Once you have clicked a button, the script no longer existed in the document. To solve this I moved it into an external file called "calendar.js"
  2. Now that the script was in a separate file, the button functions could not access the date variables. I added a "(d, m, y)" interface to the functions to get around this. I also moved the date commands near the start of the script into a new function called "GetStartDate()". This was to prevent the variables being accidentaly overwritten.
  3. The buttons now work, but the new content is written underneath the old when you click on one. Putting "document.open()" commands before writing the calendar clears the page.
Apart from that the script was fine. I only changed the "write()" commands to "writeln()" to make the generated source code look neater. Hope that helps. PM me if you have any questions.
__________________
Let teh phantasy rule your mind
Rinforzando is offline                         Send a private message to Rinforzando
Reply With Quote