• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

What is DHTML?

While JavaScript is one piece of the client-side scripting puzzle, it can't really do much on its own without the ability to work with HTML elements on the page. Dynamic HTML (DHTML) evolved from one of the original capabilities of JavaScript—the ability to swap images on the page in response to an event. With successive browser releases, both Netscape and (primarily) Microsoft expanded the ability of JavaScript to dynamically add or alter HTML on a page. Now, it's common to see pages with custom drop-down and pop-up menus, content that is shown or hidden based on a mouse click, and other graphical niceties that were never dreamt of by the originators of the Web.

DHTML uses something called the Document Object Model (DOM) as a way of accessing the elements on a page. In the DOM, individual elements on the page (such as form items, images, tables, and more) are defined as objects—self-contained units that provide their own attributes (such as the source of an image, or the height and width of an element) as well as methods (subroutines that can be called from JavaScript to perform a function, such as submitting a form). DOM objects are organized in a tree structure, with the root of the tree being the all-encompassing <head> element and the other elements accessed as children of their parent element, as shown in Figure 14.1.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint