Dynamic HTML
From Wikipedia, the free encyclopedia
| This article or section contains instructions, advice, or how-to content. The purpose of Wikipedia is to present facts, not to teach subject matter. Please help improve this article by removing or rewriting the how-to content, which may qualify for a move to Wikibooks. |
| This article does not cite any references or sources. (September 2007) Please help improve this article by adding citations to reliable sources. Unverifiable material may be challenged and removed. |
| HTML |
|---|
|
Character encodings |
Dynamic HTML or DHTML is a collection of technologies used together to create interactive and animated web sites by using a combination of a static markup language (such as HTML), a client-side scripting language (such as JavaScript), a presentation definition language (Cascading Style Sheets, CSS), and the Document Object Model.
A DHTML webpage is any webpage in which client-side scripting changes variables of the presentation definition language, which in turn affects the look and function of otherwise "static" HTML page content, after the page has been fully loaded and during the viewing process. Thus the dynamic characteristic of DHTML is the way it functions while a page is viewed, not in its ability to generate a unique page with each page load.
By contrast, a dynamic web page is a broader concept — any web page generated differently for each user, load occurrence, or specific variable values. This includes pages created by client side scripting, and ones created by server-side scripting (such as PHP or Perl) where the web server generates content before sending it to the client.
Contents |
DHTML is often used to make rollover buttons or drop-down menus on a web page.
A less common use is to create browser based action games. During the late 1990s and early 2000s, a number of games were created using DHTML. But differences between browsers made this difficult; many techniques had to be implemented in code to enable the games to work on multiple platforms. Recently browsers have been converging towards the web standards, which has made the design of DHTML games more viable. Those games can be played on all major browsers and they can also be ported to Widgets for Mac OS X and Gadgets for Windows Vista, which are based on DHTML code.
The term has fallen out of use in recent years, as DHTML scripts often tended to not work well between various web browsers. Newer techniques, such as unobtrusive JavaScript coding (DOM Scripting), allow similar effects, but in an accessible, standards-compliant way through Progressive Enhancement.
Some disadvantages of DHTML are that it is difficult to develop and debug due to varying degrees of support among web browsers of the technologies involved, and that the variety of screen sizes means the end look can only be fine-tuned on a limited number of browser and screen-size combinations. Development for relatively recent browsers, such as Internet Explorer 5.0+, Mozilla Firefox 2.0+, and Opera 7.0+, is aided by a shared Document Object Model.
Typically a web page using DHTML is set up the following way
xmlns="http://www.w3.org/1999/xhtml"> >> >> DHTML example> > > >id="navigation">> > >>Often the code is stored in an external file; this is done by linking the file that contains the JavaScript. This is helpful when several pages use the same script:
See also DOM Events
The following code illustrates an often-used function. An additional part of a web page will only be displayed if the user requests it. In e-learning, such a function could be used to display additional hints or an answer the student initially should not see.
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> >> Test> > > > >>
How to use a DOM function> >id="example1"> This is the example. (Additional information, which is only displayed on request)...>>The general text continues...> > >
- QuirksMode, a comprehensive site with test examples and instructions on how to write DHTML code which runs on several browsers.
- Introductory DHTML Tutorial for those taking their first steps in DHTML.
- HTML & DHTML Reference on MSDN
- DHTML Example, a drag-and-drop puzzle written in DHTML using Dynapi.