Share to: share facebook share twitter share wa share telegram print page
Available for Advertising

Dynamic HTML

Dynamic HTML, or DHTML, is a term which was used by some browser vendors to describe the combination of HTML, style sheets and client-side scripts (JavaScript, VBScript, or any other supported scripts) that enabled the creation of interactive and animated documents.[1][2] The application of DHTML was introduced by Microsoft with the release of Internet Explorer 4 in 1997.[3][unreliable source?]


DHTML (Dynamic HTML) allows scripting languages, such as JavaScript, to modify variables and elements in a web page's structure, which in turn affect the look, behavior, and functionality of otherwise "static" HTML 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, covering 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, Python, JSP or ASP.NET) where the web server generates content before sending it to the client.

DHTML is the predecessor of Ajax and DHTML pages are still request/reload-based. Under the DHTML model, there may not be any interaction between the client and server after the page is loaded; all processing happens on the client side. By contrast, Ajax extends features of DHTML to allow the page to initiate network requests (or 'subrequest') to the server even after page load to perform additional actions. For example, if there are multiple tabs on a page, the pure DHTML approach would load the contents of all tabs and then dynamically display only the one that is active, while AJAX could load each tab only when it is really needed.

Uses

DHTML allows authors to add effects to their pages that are otherwise difficult to achieve, by changing the Document Object Model (DOM) and page style. The combination of HTML, CSS, and JavaScript offers ways to:

  • Animate text and images in their document.
  • Embed a ticker or other dynamic display that automatically refreshes its content with the latest news, stock quotes, or other data.
  • Use a form to capture user input, and then process, verify and respond to that data without having to send data back to the server.
  • Include rollover buttons or drop-down menus.

A less common use is to create browser-based action games. Although a number of games were created using DHTML during the late 1990s and early 2000s,[4] differences between browsers made this difficult: many techniques had to be implemented in code to enable the games to work on multiple platforms. Browsers have since then converged toward web standards, which has made the design of DHTML games more viable. Those games can be played on all major browsers and in desktop and device applications that support embedded browser contexts.

The term "DHTML" has fallen out of use in recent years as it was associated with practices and conventions that tended to not work well between various web browsers.[5]

DHTML support with extensive DOM access was introduced with Internet Explorer 4.0. Although there was a basic dynamic system with Netscape Navigator 4.0, not all HTML elements were represented in the DOM. When DHTML-style techniques became widespread, varying degrees of support among web browsers for the technologies involved made them difficult to develop and debug. Development became easier when Internet Explorer 5.0+, Mozilla Firefox 2.0+, and Opera 7.0+ adopted a shared DOM inherited from ECMAScript.

Later, JavaScript libraries such as jQuery abstracted away many of the day-to-day difficulties in cross-browser DOM manipulation, though better standards compliance among browsers has reduced the need for this.

Structure of a web page

Typically a web page using DHTML is set up in the following way:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>DHTML example</title>
</head>
<body bgcolor="red">
    <script>
        function init() {
            let myObj = document.getElementById("navigation");
            // ... manipulate myObj
        }
        window.onload = init;
    </script>
    <!--
    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:
    -->
    <script src="my-javascript.js"></script>
</body>
</html>

Example: Displaying an additional block of text

The following code illustrates an often-used function. An additional part of a web page will only be displayed if the user requests it.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Using a DOM function</title>
    <style>
        a { background-color: #eee; }
        a:hover { background: #ff0; }
        #toggleMe { background: #cfc; display: none; margin: 30px 0; padding: 1em; }
    </style>
</head>
<body>
    <h1>Using a DOM function</h1>
        
    <h2><a id="showhide" href="#">Show paragraph</a></h2>
        
    <p id="toggle-me">This is the paragraph that is only displayed on request.</p>
        
    <p>The general flow of the document continues.</p>
        
    <script>
        function changeDisplayState(displayElement, textElement) {
            if (displayElement.style.display === "none" || displayElement.style.display === "") {
                displayElement.style.display = "block";
                textElement.innerHTML = "Hide paragraph";
            } else {
                displayElement.style.display = "none";
                textElement.innerHTML = "Show paragraph";
            }
        }
        
        let displayElement = document.getElementById("toggle-me");
        let textElement = document.getElementById("showhide");
        textElement.addEventListener("click", function (event) {
            event.preventDefault();
            changeDisplayState(displayElement, textElement);
        });
    </script>
</body>
</html>

Document Object Model

DHTML is not a technology in and of itself; rather, it is the product of three related and complementary technologies: HTML, Cascading Style Sheets (CSS), and JavaScript. To allow scripts and components to access features of HTML and CSS, the contents of the document are represented as objects in a programming model known as the Document Object Model (DOM).

The DOM API is the foundation of DHTML, providing a structured interface that allows access and manipulation of virtually anything in the document. The HTML elements in the document are available as a hierarchical tree of individual objects, making it possible to examine and modify an element and its attributes by reading and setting properties and by calling methods. The text between elements is also available through DOM properties and methods.

The DOM also provides access to user actions such as pressing a key and clicking the mouse. It is possible to intercept and process these and other events by creating event handler functions and routines. The event handler receives control each time a given event occurs and can carry out any appropriate action, including using the DOM to change the document.

Dynamic styles

Dynamic styles are a key feature of DHTML. By using CSS, one can quickly change the appearance and formatting of elements in a document without adding or removing elements. This helps keep documents small and the scripts that manipulate the document fast.

The object model provides programmatic access to styles. This means you can change inline styles on individual elements and change style rules using simple JavaScript programming.

Inline styles are CSS style assignments that have been applied to an element using the style attribute. You can examine and set these styles by retrieving the style object for an individual element. For example, to highlight the text in a heading when the user moves the mouse pointer over it, you can use the style object to enlarge the font and change its color, as shown in the following simple example.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Dynamic Styles</title>
    <style>
        ul { display: none; }
    </style>
</head>

<body>
    <h1 id="first-header">Welcome to Dynamic HTML</h1>

    <p><a id="clickable-link" href="#">Dynamic styles are a key feature of DHTML.</a></p>

    <ul id="unordered-list">
        <li>Change the color, size, and typeface of text</li>
        <li>Show and hide text</li>
        <li>And much, much more</li>
    </ul>

    <p>We've only just begun!</p>

    <script>
        function showMe() {
            document.getElementById("first-header").style.color = "#990000";
            document.getElementById("unordered-list").style.display = "block";
        }

        document.getElementById("clickable-link").addEventListener("click", function (event) {
            event.preventDefault();
            showMe();
        });
    </script>
</body>
</html>

See also

References

  1. ^ "Document Object Model FAQ". W3C. October 22, 2003. Retrieved 2022-02-16.
  2. ^ "Web Style Sheets". W3C. 22 July 1999. Retrieved 7 April 2018.
  3. ^ Pedamkar, Priya (2020-07-19). "DHTML | A Quick Glance of DHTML with Components, Features, Need". EDUCBA. Retrieved 2022-10-13.
  4. ^ Downes, Stephen (Aug 18, 1999). "Fun and Games With DHTML". Stephen's Web. Retrieved 2022-08-27.
  5. ^ Ferguson, Russ; Heilmann, Christian (2013). Beginning JavaScript with DOM Scripting and Ajax (PDF). Berkeley, CA: Apress. pp. 49–68. doi:10.1007/978-1-4302-5093-7. ISBN 978-1-4302-5092-0. S2CID 20526670. Retrieved May 30, 2022.

Read other articles:

Kate BruceBruce di 1921Lahir(1860-02-17)17 Februari 1860Columbus, Indiana, A.S.Meninggal2 April 1946(1946-04-02) (umur 86)New York, New York, A.S.PekerjaanAktrisTahun aktif1908-1931 Kate Bruce (17 Februari 1860 – 2 April 1946) adalah seorang aktris Amerika dari era film bisu.[1] Dia muncul di 289 film antara 1908 dan 1931. Dia lahir di Columbus, Indiana, dan meninggal di New York, New York. Pada tahun 1885, Bruce meninggalkan Boone, Iowa, dalam sebuah gerobak...

2005/06 was het 108ste seizoen in de Engelse voetbalcompetitie. Chelsea werd voor de tweede keer op rij landskampioen. Prijzen Competition Winner UEFA Super Cup Liverpool FA Premier League Chelsea FA Cup Liverpool Carling Cup Manchester United Football League Championship Reading Football League One Southend United Football League Two Carlisle United FA Community Shield Chelsea Football League Trophy Premier League Eindstand alle wedstrijden Rang Team We Wi Ge Ve Pu Vo Te Sa Fa 1 Chelsea 38 2...

Національний центр сонячної енергії Бен-Гуріона 30°51′12″ пн. ш. 34°47′00″ сх. д. / 30.85349444002777730° пн. ш. 34.7834861100277734636° сх. д. / 30.85349444002777730; 34.7834861100277734636Координати: 30°51′12″ пн. ш. 34°47′00″ сх. д. / 30.85349444002777730° пн. ш. 34.7834861100277734636°...

Beispiel für eine Antiqua-Variante Die Antiqua-Varianten sind eine Schriftklasse nach DIN 16518. Dank der heute üblichen digitalen Erstellung und Verwendung von Schriften entstanden in den letzten Jahren unzählige Varianten, die sich einer Klassifizierung entziehen. Diese oft dekorativen Schriften sind weniger für Lesetexte, sondern eher im Displaybereich brauchbar. Gemeinsam ist ihnen nur die grundsätzliche Anlehnung an die Buchstabenformen der Antiqua. Inzisen wie Frederic William Goud...

City with county rights in Tolna, Hungary This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help to improve this article by introducing more precise citations. (March 2013) (Learn how and when to remove this template message) City with county rights in Tolna, HungarySzekszárdCity with county rightsSzekszárd Megyei Jogú Város FlagCoat of armsSzekszárdShow map of Tolna CountySzekszárdSho...

NFL team season 2005 Denver Broncos seasonOwnerPat BowlenPresidentPat BowlenGeneral managerTed Sundquist and Mike ShanahanHead coachMike ShanahanOffensive coordinatorGary KubiakDefensive coordinatorLarry CoyerHome fieldInvesco Field at Mile HighResultsRecord13–3Division place1st AFC WestPlayoff finishWon Divisional Playoffs(vs. Patriots) 27–13Lost AFC Championship(vs. Steelers) 17–34 ← 2004 Broncos seasons 2006 → The 2005 season was the Denver Broncos' 36th in...

Prinz Franz Xaver, 1970 Familienwappen Prinz Franz Xaver von Bourbon-Parma (voller Name: Franz Xaver Karl Maria Anna Ludwig de Bourbon-Parma y Braganza) (* 25. Mai 1889 in der Villa Pianore, Camaiore, Provinz Lucca; † 7. Mai 1977 in Zizers bei Chur, Schweiz) war ab 1974 Titularherzog von Parma, Piacenza und Guastalla und Oberhaupt des Hauses Bourbon-Parma, spanischer carlistischer Thronprätendent von 1952 bis 1975 als Francisco Javier I. und ab 1964 Herzog von Molina. Inhaltsverzeichnis 1 ...

Permainan oray-orayan Oray-orayan merupakan Lagu Permainan Sunda yang dinyanyikan oleh anak-anak yang bermain oray-orayan atau ular-ularan, biasanya sebelum bermain suka saling memegang pundak teman yang lain yang ada di depannya.[1]Lagunya di bawah ini: Oray-orayan Luar-léor ka sawah Entong ka sawah Paréna keur sedeung beukah Oray-orayan Luar-léor mapay kebon Entong ka kebon Di kebon loba nu ngangon Mending ka leuwi Di leuwi loba nu mandi Saha anu mandi Anu mandi na pandeuri Lagu ...

A Tribe Called Quest discographyStudio albums6Compilation albums5EPs2Singles16Features singles4 A Tribe Called Quest was an American hip hop group, formed in 1985.[1] They released six studio albums, five compilations, sixteen singles and two extended plays. The group was made up of rapper/main producer Q-Tip (Kamaal Ibn John Fareed, formerly Jonathan Davis), the late rapper Phife Dawg (Malik Taylor) and DJ/co-producer Ali Shaheed Muhammad. Phife Dawg was only persuaded to join when a...

François-Xavier Nguyễn Văn Thuận Cardenal de Santa María de la Scala Presidente del Pontificio Consejo de Justicia y Paz Otros títulos Arzobispo coadjutor de Saigón, Obispo de NhatrangInformación religiosaOrdenación sacerdotal 1953Proclamación cardenalicia 2001 por San Juan Pablo IIInformación personalNombre François-Xavier Nguyễn Văn ThuậnNacimiento 17 de abril de 1928Fallecimiento 16 de septiembre de 2002 (74 años)Estudios Derecho Canónico Escudo de François-Xavier Ngu...

School of public health of the George Washington University, in Washington, DC Milken Institute School of Public HealthTypePrivateEstablished1997Parent institutionGeorge Washington UniversityDeanLynn R. GoldmanAcademic staff327Undergraduates176Postgraduates844Doctoral students86Location950 New Hampshire Ave NW, Washington, D.C. 20052CampusUrban — (Foggy Bottom)Websitepublichealth.gwu.edu The Milken Institute School of Public Health (known as School of Public Health, Milken School, or SPH) i...

Basketane Names Preferred IUPAC name Pentacyclo[4.4.0.02,5.03,8.04,7]decane Identifiers CAS Number 5603-27-0 3D model (JSmol) Interactive image ChemSpider 16736517 PubChem CID 12496332 CompTox Dashboard (EPA) DTXSID70891942 InChI InChI=1S/C10H12/c1-2-4-7-5-3(1)6-8(4)10(7)9(5)6/h3-10H,1-2H2Key: QKWLQWFMFQOKET-UHFFFAOYSA-NInChI=1/C10H12/c1-2-4-7-5-3(1)6-8(4)10(7)9(5)6/h3-10H,1-2H2Key: QKWLQWFMFQOKET-UHFFFAOYAB SMILES C2CC5C1C4C3C1C2C3C45 Properties Chemical formula C10H12 Molar mass 1...

Penggambaran lubang hitam. Radiasi Hawking adalah radiasi yang dilepaskan oleh lubang hitam akibat efek kuantum di dekat cakrawala peristiwa. Radiasi ini dinamai dari fisikawan Stephen Hawking yang membuat argumen yang mendukung keberadaannya pada tahun 1974,[1] dan kadang-kadang juga dinamai dari Jacob Bekenstein yang memperkirakan bahwa lubang hitam seharusnya memiliki suhu dan entropi yang terbatas dan tidak nol.[2] Hawking menulis karyanya setelah mengunjungi Moskwa pada t...

此條目需要补充更多来源。 (2012年9月26日)请协助補充多方面可靠来源以改善这篇条目,无法查证的内容可能會因為异议提出而被移除。致使用者:请搜索一下条目的标题(来源搜索:中日修好條規 — 网页、新闻、书籍、学术、图像),以检查网络上是否存在该主题的更多可靠来源(判定指引)。 此條目需要擴充。 (2012年9月26日)请協助改善这篇條目,更進一步的信息可...

Australian rules footballer Australian rules footballer Nat Exon Exon with Carlton in March 2017Personal informationFull name Natalie ExonNickname(s) Nat, Exxy[1]Date of birth (1992-12-07) 7 December 1992 (age 31)[2]Original team(s) Darebin Falcons (VWFL)[2]Draft Rookie player, 2016Debut Round 1, 2017, Carlton vs. Collingwood, at Princes ParkHeight 162 cm (5 ft 4 in)[3]Position(s) MidfieldClub informationCurrent club St KildaN...

Commune in Auvergne-Rhône-Alpes, FranceChaponostCommuneChurch of ChaponostLocation of Chaponost ChaponostShow map of FranceChaponostShow map of Auvergne-Rhône-AlpesCoordinates: 45°42′39″N 4°44′33″E / 45.7108°N 4.7425°E / 45.7108; 4.7425CountryFranceRegionAuvergne-Rhône-AlpesDepartmentRhôneArrondissementLyonCantonBrignaisIntercommunalityVallée du GaronGovernment • Mayor (2020–2026) Damien Combet[1]Area116.32 km2 (6.30 ...

ArgapuraKecamatanNegara IndonesiaProvinsiJawa BaratKabupatenMajalengkaPemerintahan • CamatH. Wawan Kurniawan, S. Sos. MT.Populasi • Total34,234 orang (2.005) jiwaKode Kemendagri32.10.05 Kode BPS3210050 Desa/kelurahan14 Argapura adalah sebuah kecamatan di Kabupaten Majalengka, Provinsi Jawa Barat, Indonesia. Kecamatan ini berjarak sekitar 15 Km dari ibu kota Kabupaten Majalengka. Ibu kotanya berada di Desa Sukasari Kidul. Nama Argapura menurut arti gramatikal, dari...

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: List of representations of e – news · newspapers · books · scholar · JSTOR (December 2007) (Learn how and when to remove this template message) Part of a series of articles on themathematical constant e Properties Natural logarithm Exponential function Applicat...

2006 compilation album by EraserheadsAnthology TwoCompilation album by EraserheadsReleasedAugust 16, 2006 (2006-08-16)Recorded1990-2002GenreAlternative rock, indie rock, pop rock, Christmas musicLength51:35 (disc 1)63:55 (disc 2)LabelMusiko Records & Sony BMG Music Entertainment (Philippines) Inc.ProducerRobin Rivera, Eraserheads, Ed Formoso and DemEraserheads chronology Eraserheads Anthology(2004) Anthology Two(2006) Eraserheads: The Reunion Concert 08.30.08(2008) ...

German rowing coach For other people named Karl Adam, see Karl Adam (disambiguation). Karl AdamKarl Adam in 1968Born(1912-05-02)2 May 1912Hagen, GermanyDied18 June 1976(1976-06-18) (aged 64)Bad Salzuflen, GermanyNationalityGermanKnown forTheoretical studies about rowing technique Karl Adam (2 May 1912 in Hagen – 18 June 1976 in Bad Salzuflen) was one of the most successful and innovative German rowing coaches. Although he was never an active rower himself, he helped win 29 med...

Kembali kehalaman sebelumnya