Chapter 15. Dynamic Content Applications


This chapter’s recipes attempt to provide solutions for real-world challenges that you may encounter in your DHTML development. The difficulty in arriving at such a roster of solutions is that DHTML is flexible enough to inspire the imaginations of every developer in different directions. While most of the recipes here can be used as-is, they are also meant to serve as basic foundations upon which you can build your specific application. If these recipes give you ideas for ways to add value to your site, all the better.

Several of the recipes in this chapter rely on scriptable objects whose powers are not always easy to grasp: the JavaScript core language Date object (covered in depth in Chapter 2), and an object representing text ranges (known as the TextRange object in IE for Windows and the Range object in the W3C DOM). The abstract nature of these objects and the technical details of their operation can cause numerous conceptual problems along the way.

Although the details of text range implementations in the IE for Windows and W3C DOMs are quite different, their fundamental operations are the same. At its core, a text range is a sequence of body text separate from the HTML elements that surround or are nested within the sequence. You don’t see a text range, per se, although it is possible to highlight its text for the user to see, if it’s important to your application.

A text range has a starting point and an ending point. ...

Get JavaScript & DHTML Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.