The terms DHTML , dynamic HTML ( English dynamic HTML ) or DOM scripting designate certain web design methods in which the website itself is changed during the display, triggered by user input.
The term "dynamic" refers to the idea that these changes are caused by events that can occur multiple times when a page is displayed.
Examples of dynamic display effects are:
- the appearance ("unfolding") of a menu
- highlighting a text
- the ability to drag and drop objects around the screen
- Automatically fill form fields depending on other fields
- Websites that can be operated like client-side application programs .
Dynamic HTML includes the following techniques:
- HTML for writing documents
- an interface for changing and expanding the HTML document, today the Document Object Model (DOM) is mainly used
- XMLHttpRequest to exchange data between the browser and a remote HTTP server (see also Ajax ).
- Fetch API to exchange data between the browser and a remote HTTP server.
- a format for the transmission of structured data, such as XML or JSON
Not all of the techniques in this list have to be used in a document (especially those for data transfer after the first loading) in order to be able to describe it as an application of dynamic HTML.
A simple example of a dynamic HTML section in which the displayed text changes when clicked:
... <p onclick="this.firstChild.nodeValue = 'Danke'">Klick mich</p> ...
Criticism and cons
Dynamic HTML is often used for effect-oriented functions where the benefits are not clearly recognizable and which tend to be annoying.
In the early days, DHTML could only be implemented using browser- specific so-called DHTML models that were not mutually compatible. As a result, some DHTML pages produced errors on certain browsers. That reputation rests with dynamic HTML to this day. Therefore, the term DOM scripting is used today, with which one would like to distinguish standard-compliant DHTML from browser-specific variants.