HTML
  Home arrow HTML arrow Page 4 - Showing a Full Year with a Web Page Calend...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Showing a Full Year with a Web Page Calendar
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-05-18

    Table of Contents:
  • Showing a Full Year with a Web Page Calendar
  • The Show Current Year's Calendar Button
  • The showYear() Function
  • Explanation of the showYear() Function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Showing a Full Year with a Web Page Calendar - Explanation of the showYear() Function


    (Page 4 of 4 )

    This function is called by the Show Current Year's Calendar and Show any Year's Calendar buttons. When it is called by the Show Current Year's Calendar button, the argument passed is "current," meaning the current year. When it is called by the Show any Year's Calendar button, the argument that is passed is the year (e.g. 2005) of your choice.

    Another function we saw which uses the word "current" as an argument is showMonth(). With this function, the argument "current" refers to the current month, while with the showYear() function, we are referring to the current year. Do not confuse the roles of the "current" value between these two functions.

    The first thing the showYear() function does is declare the date variable. This variable will become a date object. This date can either have the year for the current year or the year of your choice.

    The next statement you have is an if-statement. If the argument received by the showYear() function is "current," then the if-statement creates a date object without its own arguments. When a date object is created without arguments, it is the current date object. This current date will be used to create the current yearly calendar. The newly-created date object is assigned to the date variable we have just seen.

    If the argument of the showYear() function received was the year of your choice, then the if-statement creates a new date object with the year of your choice. This date object will be used to create the year calendar of the year of your choice. This alternative newly-created date object is assigned to the date variable that we have just seen.

    The next thing we have is the declaration of the monthI variable. This variable will have the value A, or B, or C --- L. Remember, each of this letters represents a particular month of the year.

    The next statement is a for-loop. It is this for-loop that calls the showMonth() function twelve times to display the twelve months of the yearly calendar. The first statement in the for-loop is an if-else-if statement. For the first iteration, the if-else-if statement assigns the value A to the monthI variable. For the second iteration, the monthI variable is assigned the value B. For the third iteration, it is C, and so on, until the twelfth iteration, which is L.

    After the if-else-if statement in the for-loop, the next statement sets the month for the date object. The month is set twelve times for the numbers 0 to 11, each number for each iteration. When the showMonth() function is called, this set of months will be used to create the calendar for the year.

    The last statement in the for-loop calls the showMonth() function. The showMonth() function will be modified again, and it will receive three arguments, as follows:


    function showMonth(date, theMonth, monthI)


    This function is called twelve times by the for-loop of the showYear(year) function. The first parameter, date, has the year of the particular month. For the twelve times the function is called, the value of the year attribute does not change, but the value (0 or 1 --- 11) for the month attribute changes.

    The second parameter, theMonth, is important to only the first button, Show Current Month's Calendar. When this button is clicked, the argument is "current." For any other call of the showMonth() function the argument is "".

    The last parameter, monthI, is used to set the IDs in the showMonth() function. This argument may be A or B --- L. Each of these letters corresponds to a number for the month in the date argument. So the last statement in the for-loop is:


    showMonth(date, "", monthI);


    Well, that is it for the showYear() function. We shall take a break here and continue in the next part of the series. As I have been saying, I will give you all the code in a zip file.


    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.

     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek