Download presentation
Presentation is loading. Please wait.
Published byMatthew Moody Modified over 9 years ago
1
CSS1 Dynamic HTML Objects, Collections & Events
2
CSS2 Introduction Dynamic HTML treats HTML elements as objects. Element’s parameters can be treated as properties, whose values can be changed through a scripting language, dynamically. Web page, which consists of elements, forms, frames, tables, etc., is represented as an object hierarchy.
3
CSS3 Hierarchy window document frames history navigator location event screen document plugins all anchors body applets filters embeds forms images links plugins object collection Key
4
CSS4 Elements as Objects How can the individual elements in a document be accessed? Using the id parameter.
5
CSS5 Example 1 Object Model function start() { alert( pText.innerText ); pText.innerText = "Thanks for coming."; } Welcome to our Web page!
6
CSS6 Collections Dynamic HTML has collections besides objects. Collections are basically arrays of related objects on a page. Special collections: all collection Other collections: anchors, forms, images, links, plug-ins, scripts, etc.
7
CSS7 Example 2 Object Model var elements = ""; function start() { for ( var loop = 0; loop < document.all.length; ++loop ) elements += " " + document.all[ loop ].tagName; pText.innerHTML += elements; } Elements on this Web page:
8
CSS8 Events Dynamic HTML allows event driven programs (scripts) to run on the client side. This can make a web page responsive to the users actions. Web page content becomes dynamic. All these things happen without loading the server.
9
CSS9 Event Example: Onclick DHTML Event ONCLICK alert( "Hi there" ); Click on this text!
10
CSS10 Event Example: Onmouseover DHTML Event - ONMOUSEMOVE event function updateMouseCoordinates() { coordinates.innerText = event.srcElement.tagName + " (" + event.offsetX + ", " + event.offsetY + ")";} (0, 0) <IMG SRC = "deitel.gif" STYLE = "position: absolute; top: 100; left: 100">
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.