Notes for Web Technology on the basis of GGSIPU BCA Syllabus
DHTML Once a web server processes a web page and sends it to the computer requesting it (called the 'Client' computer) it cannot get any more data from the server unless a new request is made. So to move around this drawback we use Dynamic HTML (DHTML) which is combining HTML and a scripting language that runs on the Client's browser to bring special effects to otherwise static pages. The scripting language that we will be using is JavaScript as most browsers support it. The scripting language can be used to alter HTML data shown (or present but hidden) on the current page by manipulating the properties for the HTML tags involved. Dynamic HTML" is typically used to describe the combination of HTML, style sheets and scripts that allows documents to be animated. Dynamic HTML allows a web page to change after it's loaded into the browser - there there doesn't have to be be any communicat communication ion with the web server server for an update. update. You can can think of it as 'animated' HTML. For example, a piece of text can change from one size or color to another, or a graphic can move from one location to another, in response to some kind of user action, such as clicking a button. It is a browser feature that allows your browser (Netscape Navigator 4.x orhigher, or
Microsoft Internet Explorer 4.x 4.x or higher) to be dynamic. A “dynamic” browser can alter a Web page’s look after the document has loaded.
Dynamic (relative to Web) refers to:
Web pages that respond to user requests through buttons or other types of controls Various types of effects such as animation that appear automatically in a Web browser
Advantages of DHTML (1) DHTML makes documents dynamic. Dynamic documents :
Allow the designer to control how the HTML displays Web pages’ content. React and change with the actions of the visitor. Can exactly position any element in the window, and change that position after the document has loaded.
By Savleen Kaur, Assistant Professor IITM-JP, GGSIPU New Delhi
Page | 1
Notes for Web Technology on the basis of GGSIPU BCA Syllabus
Can hide and show content as needed.
(2) DHTML allows any HTML element(any object on the screen that can be controlled independently using JavaScript) in Internet Explorer to be manipulated at any time, turning plain HTML into dynamic HTML. (3) With DHTML, changes occur entirely on the client-side( on the user’s browser). (4) Using DHTML gives the author more control over how the page is formatted and how content is positioned on the page.
Components of DHTML Dynamic HTML includes the following components:
Conventional HTML
Scripts – Small programs designed to manipulate Web pages.
Document Object Model (DOM) – The road map through which you can locate any element in an HTML document and use a scripting language, such as JavaScript, to change the element’s properties. Absolute Positioning – The elements on the page are placed in a fixed location, as opposed to relative positioning, in which an element’s location is relative to particular elements on the page. Multimedia filters – Multimedia features that create visual effects for text, images, and other objects, without imposing long download times on the user.
Note: Conventional HTML and Scripts component of DHML are already covered.
By Savleen Kaur, Assistant Professor IITM-JP, GGSIPU New Delhi
Page | 2
Notes for Web Technology on the basis of GGSIPU BCA Syllabus
The Document Object Model (DOM)
What is the DOM?
The DOM is like a roadmap of your Web page. You describe a path that leads from the HTML document down to the various elements on the page. The DOM for an image called button1 would be: document.images.button1.
The Document Object Model was created with these four goals in mind:
To delineate a hierarchical structure representing all parts of a Web document. To allow the modification of that structure through adding and removing content. To provide a way to monitor and manipulate the characteristics of content on the page. To provide information about how the items on a page interrelate with the user and each other
What Does the DOM Allow us to Do?
The Web page author can connect any element on the screen to a JavaScript. He or she can use scripts to control everything on the page and to change virtually anything at any time.
Some examples of effects the designer can create using the DOM with script:
o A button’s image changes when the user passes the mouse over it . o The user can drag text or images around on a page. o Some of the items on a page mover around without user interaction and end up positioned exactly where the author wants them. o When the user positions the mouse over an image, text appears. o The Web page author can change the formatting of text, graphics, and tables on the fly.
By Savleen Kaur, Assistant Professor IITM-JP, GGSIPU New Delhi
Page | 3
Notes for Web Technology on the basis of GGSIPU BCA Syllabus
o Parts of the page are dynamically created or destroyed as they appear on the screen
How the DOM works?
The DOM works by tracing a path from the script down to the individual elements to be acted upon with the HTML document. The steps in this hierarchy are: window (parent) (frame) document ID image link anchor form
Components of the DOM The DOM is comprised of these components: Objects – The object is the basic unit of the DOM. Every element on the page is
part of the DOM. Text and images are examples of objects. A table would be a parent object; its cells would be children of the table. A form named “MyForm” could be referred to as: