O'Reilly logo

HTML, XHTML, and CSS Bible, Fifth Edition by Steven M. Schafer

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 17. Dynamic HTML

IN THIS CHAPTER

  • The Need for DHTML

  • How DHTML Works

  • The Document Object Model

  • The JavaScript DOM

  • Using Event Handlers

  • Accessing an Element by Its ID

  • Cross-Browser Compatibility Issues

  • DHTML Examples

  • Form Automation: Check boxes

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 enables you to access 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 a lot 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, Document Object Model (DOM) scripting has emerged to enable 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 experience. ...

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