Tham khảo sách 'javascript bible_ chapter 47', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Application Tables and Calendars Working with HTML tables is a lot of fun especially if like me you are not a born graphics designer. By adding a few tags to your page you can make your data look more organized professional and appealing. Having this power under scripting control is even more exciting because it means that in response to a user action or other variable information such as the current date or time a script can do magic things to the table as the table is being built. You have two options when designing scripted tables for your pages to create static tables or dynamic tables. The design path you choose has a great deal to do with whether you need to dynamically update some or all fields of a table data inside TD . TD tags . To highlight the differences between the two styles this chapter traces the implementation of a monthly calendar display in both static and dynamic formats in a single-frame window. About the Calendars Because the emphasis here is on the way tables are scripted and displayed I quickly pass over structural issues of the two calendar versions described in the following sections. Both versions implement calendar data the same way as objects. As the next two listings show the calendars for display need the names of the months to appear in my language English somewhere in the script so that they can be plugged into the calendar heading as needed. To make some of the other calendar calculations work such as figuring out which day of the week is the first day of a given month in a given year I define a method for my month objects. The method returns the JavaScript date object value for the day of the week of a month s first date. Virtually everything I do to implement the month objects is adapted from the custom objects discussion of Chapter 34. In This Chapter Scripted tables Date calculations 2 JavaScript Applications Static tables The issue of updating the contents of a table s fields is tied to the nature of an HTML document being .