Home arrow HTML arrow Page 4 - Building the Current Year with a Web Page Calendar
HTML

Building the Current Year with a Web Page Calendar


In the previous part of this eight-part series on building a web page calendar, we began a discussion of how to get the program to display any month the user wished to see. In this part, we complete that aspect of the application, and take the first step to enabling it to display an entire year. This is the fifth part of the series.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
May 11, 2009
TABLE OF CONTENTS:
  1. · Building the Current Year with a Web Page Calendar
  2. · Explanation of the receiveYearMonth() Function
  3. · Need for More Modification
  4. · Modification of the showMonth() Function Again

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building the Current Year with a Web Page Calendar - Modification of the showMonth() Function Again
(Page 4 of 4 )

After changing the IDs of the elements of the single month calendar, we have to modify the showMonth() Function to reflect the change. The change will affect many statements that make use of the IDs.

The statement to display the month in the first Input Text control was:


document.getElementById('I1').value = monthArray[month];


It should now be:


document.getElementById('I01').value = monthArray[month];


The statement to display the year in the second Input Text control was:


document.getElementById('I2').value = year;


It should now be:


document.getElementById('I02').value = year;


The change in the above statements is in the IDs. The change in the rest of the following statements is also in the IDs.


Each of the for-loops has to form the ID of table cell in the single month calendar. The line for this for each of the for-loops was:


tdID = "M" + i + j;


It should now be:


tdID = "M0" + i + j;


The line that extracted the row number from the ID was:


var rowNo = tdID.charAt(1);


It should now be:


var rowNo = tdID.charAt(2);


The line extracted the column number from the ID was:


var colNo = tdID.charAt(2);


It should now be:


var colNo = tdID.charAt(3);


This change is applicable for the single month calendar.


What We have done So Far

We started by creating the calendar for the current month. Next we had to create the calendar for any month. In order not to write too much code, we had to use the same function that was used to create the current month calendar. In order to achieve this we had to modify the showMonth() function.

In fact we have modified it twice: once to be able to create the calendar of any month, and now, to enable us to display twelve months at once. The change we have made here enables us to display the current calendar or calendar of any month, while having the code to display twelve months. I have not yet shown you the code to display twelve months. I have shown you the code for a single month that is compatible with the code for twelve months.

Before we end this part of the series, always remember that the responsibility of specifying the current month was given to the Show Current Month's Calendar button (attribute); this remains so. We shall next see the layout of the HTML elements for the year and continue.

See you in the next part of the series.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials