DHTML: Working with Objects Creating a Dynamic Web Page.

Slides:



Advertisements
Similar presentations
JavaScript Objects - DOM CST 200 JavaScript. Objectives Introduce JavaScript objects Introduce Document Object Model Introduce window object Introduce.
Advertisements

The Web Warrior Guide to Web Design Technologies
Chapter Concepts Review Markup Languages
Tutorial 16 Working with Dynamic Content and Styles.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
ISP 523: Fundamentals of Information Technology Instructor: Stephen Lackey November 2, 2005.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic DHTML.
Chapter 7: Dynamic HTML and Animation JavaScript - Introductory.
Tutorial 13 Working with Objects and Styles. XP Objectives Learn about objects and the document object model Reference documents objects by ID, name,
CSC 2720 Building Web Applications JavaScript. Introduction  JavaScript is a scripting language most often used for client-side web development.  JavaScript.
1st Project Introduction to HTML.
Chapter ONE Introduction to HTML.
INTRODUCTION TO CLIENT-SIDE WEB PROGRAMMING ACM 511 ACM 262 Course Notes.
DHTML - Introduction Introduction to DHTML, the DOM, JS review.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
INTRODUCTION TO DHTML. TOPICS TO BE DISCUSSED……….  Introduction Introduction  UsesUses  ComponentsComponents  Difference between HTML and DHTMLDifference.
4.1 JavaScript Introduction
 2004 Prentice Hall, Inc. All rights reserved. Chapter 13 - Dynamic HTML: Object Model and Collections Outline 13.1 Introduction 13.2 Object Referencing.
XP New Perspectives on XML, 2 nd Edition Tutorial 10 1 WORKING WITH THE DOCUMENT OBJECT MODEL TUTORIAL 10.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
Lesson 19. JavaScript errors Since JavaScript is an interpreted language, syntax errors will usually cause the script to fail. Both browsers will provide.
DHTML Positioning and Layout. What is DHTML? HTML and xHTML CSS JavaScript or VBScript.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Creating an Animated Web Page
Working with Objects Creating a Dynamic Web Page.
CITS1231 Web Technologies JavaScript and Document Object Model.
XP Tutorial 4 New Perspectives on JavaScript, Comprehensive1 Working with Objects Creating an Animated Web Page.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
JavaScript, Fourth Edition
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
5.2 DOM (Document Object Model). 2 Motto: To write it, it took three months; to conceive it three minutes; to collect the data in it — all my life. —F.
XP Tutorial 12 New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with Special Effects Creating Rollovers, Menus, Filters, and Transitions.
XHTML and CSS Session 1 Intro, (X)HTML, CSS, W3C, browsers, webpage, structure, tags, attributes, elements, web development process, basic XHTML elements.
DHTML - Introduction Chapter Introduction to DHTML, the DOM, JS review.
 2001 Deitel & Associates, Inc. All rights reserved. 1 Chapter 20 – Dynamic HTML: Object Model and Collections Outline 20.1Introduction 20.2Object Referencing.
XP Tutorial 6 New Perspectives on JavaScript, Comprehensive1 Working with Windows and Frames Enhancing a Web Site with Interactive Windows.
Chapter 7: DHTML: Object Model and Collections CIS 275—Web Application Development for Business I.
XP Tutorial 16 New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with Dynamic Content and Styles Creating a Dynamic Table of Contents.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 13 - Dynamic HTML: Object Model and Collections Outline 13.1 Introduction 13.2 Object Referencing.
Session: 1. © Aptech Ltd. 2Introduction to the Web / Session 1  Explain the evolution of HTML  Explain the page structure used by HTML  List the drawbacks.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 1.
DHTML. What is it? Dynamic HTML. Not a standard unlike HTML or Java It is a term applied by both Netscape and Microsoft to a collection of technologies.
CSS1 Dynamic HTML Objects, Collections & Events. CSS2 Introduction Dynamic HTML treats HTML elements as objects. Element’s parameters can be treated as.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming DHTML Example.
TOPIC II Dynamic HTML Prepared by: Nimcan Cabd Cali.
Web Terminology Intro to Web. North Lake College 2 by Sean Griffin HTML vs. XHTML HTML: Hypertext Markup Language XHTML: eXtensible Hypertext Markup Language.
XP Tutorial 5 New Perspectives on JavaScript, Comprehensive1 Working with Special Effects Creating Rollovers, Menus, Filters, and Transitions.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Lesson 30: JavaScript and DHTML Fundamentals. Objectives Define and contrast client-side and server-side technologies used to create dynamic content for.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 15 – Dynamic HTML: Object Model and Collections Outline 15.1Introduction 15.2Object Referencing.
Chapter 10 Dynamic HTML (DHTML) JavaScript, Third Edition.
Chapter 13: DHTML: Object Model and Collections CIS 275—Web Application Development for Business I.
HTML PROJECT #1 Project 1 Introduction to HTML. HTML Project 1: Introduction to HTML 2 Project Objectives 1.Describe the Internet and its associated key.
DHTML.
Web Basics: HTML/CSS/JavaScript What are they?
Project 1 Introduction to HTML.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
JavaScript Event Handling.
Project 1 Introduction to HTML.
Section 17.1 Section 17.2 Add an audio file using HTML
Introduction to Programming the WWW I
Section 10.1 YOU WILL LEARN TO… Define scripting
DHTML Javascript Internet Technology.
Chapter 13 - Dynamic HTML: Object Model and Collections
DHTML Javascript Internet Technology.
Introduction to Programming the WWW I
Introduction to DHTML, the DOM, JS review
Presentation transcript:

DHTML: Working with Objects Creating a Dynamic Web Page

Introduction to DHTML Developers began to look for ways to create dynamic pages New approach, in which the HTML code itself supported dynamic elements Known collectively as dynamic HTML, or DHTML

Introduction to DHTML Interaction of three aspects –A page’s HTML/XHTML code –A style sheet that defines the styles used in the page –A script to control the behavior of elements on the page

Introduction to DHTML Some uses –Animated text –Pop-up menus –Rollovers –Web pages that retrieve their content from external data sources –Elements that can be dragged and dropped

Understanding JavaScript Objects JavaScript is an object-based language An object is any item associated with a Web page or Web browser Each object has –Properties –Methods

Exploring the Document Object Model The organized structure of objects and events is called the document object model, or DOM Every object related to documents or to browsers should be part of the document object model In practice, browsers differ in the objects that their document object models support

Exploring the Document Object Model Development of a Common DOM –Basic model, or DOM Level 0 –Supported browser window, Web document, and the browser itself –Development followed two paths: one adopted by Netscape and the other adopted by Internet Explorer –Internet Explorer DOM also provided for capturing events

Exploring the Document Object Model Development of a Common DOM –World Wide Web Consortium (W3C) stepped in to develop specifications for a common document object model DOM Level 1 DOM Level 2 DOM Level 3

Exploring the Document Object Model Development of a Common DOM –Within each DOM, particular features may not be supported by every browser –Code should be compatible with Netscape 4 Internet Explorer 5 W3C DOM Level 1 and 2

Exploring the Document Object Model The document tree

Referencing Objects A DOM can be used by any scripting language including JavaScript and Java

Referencing Objects Object Names –Each object is identified by an object name

Referencing Objects Object Names –General form is object1.object2.object3… –To reference the history you would use the form window.history –For the body, you would use document.body

Referencing Objects Working with Object Collections –Objects are organized into arrays called object collections document.collection

Referencing Objects Working with Object Collections

Referencing Objects Using document.all and document.getElementById –Not all elements are associated with an object collection –Can reference these objects using their id values document.all[“id”] document.all.id document.getElementById(“id”)

Referencing Objects Referencing Tags –Internet Explorer DOM document.all.tags(tag) –W3C DOMs document.getElementsbyTagName(“tag”) document.getElementsbyTagName(“p”)[0]

Working with Object Properties The syntax for setting the value of an object property is object.property = expression Example document.title = “XHTML update”

Working with Object Properties

Some properties are read-only

Creating a Cross-Browser Web Site You can create this kind of code, known as cross-browser code, using two different approaches: browser detection or object detection

Creating a Cross-Browser Web Site Using Browser Detection –Using browser detection, your code determines which browser (and browser version) a user is running navigator.appName –Most browser detection scripts – commonly known as browser sniffers – use this property to extract information about the version number navigator.uerAgent

Creating a Cross-Browser Web Site Using Object Detection –With object detection, you determine which document object model a browser supports var NS4DOM = document.layers ? true:false; var IEDOM = document.all ? true:false; var W3CDOM = document.getElementByID ? true:false;

Creating a Cross-Browser Web Site Employing Cross-Browser Strategies –One strategy, called page branching, creates separate pages for each browser along with an initial page –A script determines the capabilities of the user’s browser and automatically loads the appropriate page

Creating a Cross-Browser Web Site Employing Cross-Browser Strategies

Working with the style Object The syntax for applying a style is object.style.attribute = value