O'Reilly logo

JavaScript® Bible, Seventh Edition by Paul Novitski, Danny Goodman, Tia Gustaff Rayl, Michael Morrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 52. Application: Tables and Calendars

IN THIS CHAPTER

  • Accommodating older browsers

  • Scripted tables

  • Date calculations

Working with HTML tables is a lot of fun, especially if you are not a born graphic designer. By adding a few tags to your page, you can make your columnar 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 things to the table as the table is being built. Modern browsers allow scripts to modify the content and structure of a table even after the page has loaded, allowing the page to almost "dance."

You have three options when designing scripted tables for your pages, although only two are compatible with non-DHTML browsers (such as legacy browsers and some mobile browsers):

  • Static tables

  • Dynamic tables

  • Dynamic HTML tables

The design path you choose is determined by whether you need to dynamically update some or all fields of a table (data inside <td>...</td> tags), and which browser levels you need to support. To highlight the differences among the three styles, this chapter traces the implementation of a monthly calendar display in all three formats.

About the Calendars

Because the emphasis here is on the way tables are scripted and displayed, we quickly pass over structural issues in the calendar versions described in the following sections. The first two examples are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required