Chapter 17. Dynamic HTML

IN THIS CHAPTER

  • The need for DHTML

  • How DHTML works

  • The document object model

  • The JavaScript document object model

  • Accessing an element by its ID

  • Using event handlers

  • Cross-browser compatibility issues

  • DHTML examples

Dynamic HTML (DHTML) is a combination of HTML, CSS, and JavaScript, used to create dynamic Web page effects. These can be animations, dynamic menus, text effects such as drop shadows, text that appears when a user rolls over an item, and other similar effects.

This chapter introduces DHTML by reviewing some JavaScript basics and providing a look at the Document Object Model (DOM), which allows you access to HTML elements so you can change their properties and/or content. Examples of common DHTML techniques are provided.

Note

In a very strict, technical sense, DHTML is thought of as containing code that is targeted toward level 4 browser architecture with lots of proprietary code. For example, such a script would be written for a particular platform, use proprietary hooks and code existing only on that platform, and would be incompatible with other platforms.

However, a new term, Document Object Model (DOM) scripting has emerged to refer to scripts that follow cross-browser–compatible standards and, hence, are more compatible with more platforms.

That said, DHTML is still the predominant term used for the dynamic combination of HTML, CSS, and JavaScript and, as such, is used here.

The Need for DHTML

DHTML, when used correctly, can significantly enhance the user ...

Get HTML, XHTML, and CSS Bible, Fourth Edition 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.