Pemrograman Teknologi Internet W09: DOM & DHTML. 2 Objectives DOM: DOM: DOM Nodes & Trees DOM Nodes & Trees Traversing & Modifying DOM Trees Traversing.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
Advertisements

Cascading Style Sheets
/k/k 1212 Cascading Style Sheets Part one Marko Boon
Chapter 6 More CSS Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Today CSS HTML A project.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
INTRODUCTORY Tutorial 7 Creating Liquid Layouts. XP Objectives Discern the differences among various types of layouts Create a liquid layout Create a.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
Cascade Style Sheet Demo. Cascading Style Sheets Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to.
Session 12 Dynamic HTML: Filters and Transitions, Data Binding with Tabular Data Control Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
Tutorial 16 Working with Dynamic Content and Styles.
Using Cascading Style Sheets CSS Basics. Goals Understand basic syntax of Cascading Style Sheets (CSS) Understand basic syntax of Cascading Style Sheets.
 2008 Pearson Education, Inc. All rights reserved Document Object Model (DOM): Objects and Collections.
1 By: Nathan Mittler For CSCI 344 Spring INTRODUCTION DHTML builds on to the capabilities of HTML Currently supported by Microsoft Internet Explorer.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic DHTML.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 15 - Dynamic HTML: Filters and Transitions Outline 15.1 Introduction 15.2 Flip Filters: flipv and.
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.
4.1 JavaScript Introduction
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 13 - Dynamic HTML: Object Model and Collections Outline 13.1 Introduction 13.2 Object Referencing.
1 JavaScript: Objects and Object Models October 25, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel,
Intro to Dreamweaver Web Design Section 7-1 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course.
Tutorial 5 Formatting with CSS. Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 3.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 13 - Dynamic HTML: Object Model and Collections Outline 13.1 Introduction 13.2 Object Referencing.
 2001 Deitel & Associates, Inc. All rights reserved. 1 Chapter 20 – Dynamic HTML: Object Model and Collections Outline 20.1Introduction 20.2Object Referencing.
Professor Waterman Cascading Style Sheets (CSS) is a language that works with HTML documents to define the way content is presented. The presentation.
DHTML1-1 Dynamic HTML: Filters & Data Binding with Table Xingquan (Hill) Zhu
Chapter 15 DHTML: Filters and Transitions CIS 275—Web Application Development for Business I.
Dynamic HTML: Filters and Transitions
Dynamic HTML IV: Filters and Transitions Making Text glow glow filter –Add aura of color around text –Specify color and strength –Add padding.
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.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
CSS1 Dynamic HTML Objects, Collections & Events. CSS2 Introduction Dynamic HTML treats HTML elements as objects. Element’s parameters can be treated as.
Introduction to DHTML. What is DHTML? Dynamic HTML Just as Access is Dynamic Database environment Can have controls that respond to events Can have centralized.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 17 – Dynamic HTML: Filters and Transitions Outline 17.1Introduction 17.2Flip filters: flipv.
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.
XP Tutorial 10 New Perspectives on JavaScript, Comprehensive 1 Working with Dynamic Content and Styles Creating a Dynamic Table of Contents.
Chapter 13: DHTML: Object Model and Collections CIS 275—Web Application Development for Business I.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
Java Script and the DOM DOM stands for: –The Document Object Model When a browser reads a web page, it converts it’s contents from HTML into a hierarchical.
Working with Cascading Style Sheets
DHTML.
Programming Web Pages with JavaScript
The Box Model in CSS Web Design – Sec 4-8
Style Sheets.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
The Box Model in CSS Web Design – Sec 4-8
Chapter 15 - Dynamic HTML: Filters and Transitions
The Box Model in CSS Web Design – Sec 4-8
Chapter 6 More CSS Basics Key Concepts
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
The Internet 10/13/11 The Box Model
DHTML Javascript Internet Technology.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
Chapter 13 - Dynamic HTML: Object Model and Collections
Chapter 13 - Dynamic HTML: Object Model and Collections
DHTML Javascript Internet Technology.
Working with Dynamic Content and Styles
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
The Internet 10/6/11 Cascading Style Sheets
SEEM4570 Tutorial 3: CSS + CSS3.0
Tutorial 3 Working with Cascading Style Sheets
Presentation transcript:

Pemrograman Teknologi Internet W09: DOM & DHTML

2 Objectives DOM: DOM: DOM Nodes & Trees DOM Nodes & Trees Traversing & Modifying DOM Trees Traversing & Modifying DOM Trees DOM Collections DOM Collections Dynamic Styles Dynamic Styles DHTML (IE Only) DHTML (IE Only) Filter & Transitions Filter & Transitions

DOM DOM stands for Document Object Model DOM stands for Document Object Model DOM is a cross-platform and language- independent convention for representing and interacting with objects in HTML, XHTML and XML documents. DOM is a cross-platform and language- independent convention for representing and interacting with objects in HTML, XHTML and XML documents. 3

Object Referencing The simplest way to reference an element is by using the element’s id attribute. The element is represented as an object, and its various XHTML attributes become properties that can be manipulated by scripting The simplest way to reference an element is by using the element’s id attribute. The element is represented as an object, and its various XHTML attributes become properties that can be manipulated by scripting 4

Using id (IE Only) <html><head> <title>Intro</title> <!-- function start() { alert(pText.innerText); pText.innerText = "Thanks for coming"; } // --> </script></head> Welcome to our Web Page! Welcome to our Web Page! </body></html> 5

Collections ‘all’ The all collection is a collection of all the XHTML elements in a document, in the order in which they appear. The all collection is a collection of all the XHTML elements in a document, in the order in which they appear. This provides an easy way of referring to any specific element, especially if it does not have an id. This provides an easy way of referring to any specific element, especially if it does not have an id. 6

Collections ‘all’ var elements = ""; function start() { for (var loop = 0; loop < document.all.length; ++loop) elements += " " + document.all[loop].tagName; pText.innerHTML += elements; alert(elements);} 7

Collections ‘children’ A collection similar to the all collection is the children collection, which for a specific element contains that element’s child elements. A collection similar to the all collection is the children collection, which for a specific element contains that element’s child elements. For example, an html element has only two children—the head element and the body element. For example, an html element has only two children—the head element and the body element. 8

Collections ‘children’ var elements = " "; function child(object) { var loop = 0; elements += " " + object.tagName + " "; for (loop = 0; loop < object.children.length; loop++) { if (object.children[loop].children.length) child(object.children[loop]);else elements += " " + object.children[loop].tagName + " "; } elements += " "; } 9

Dynamic Styles An element’s style can be changed dynamically. An element’s style can be changed dynamically. For example: For example: the background color as document.body.style.backgroundColor the background color as document.body.style.backgroundColor the body property of the document object refers to the body element. the body property of the document object refers to the body element. the style object (a property of most XHTML elements) to set the background-color CSS property the style object (a property of most XHTML elements) to set the background-color CSS property 10

Dynamic Styles 1 function start() { var inputColor = prompt("Enter a background color name"); document.body.style.backgroundColor = inputColor; } 11

Dynamic Styles 2 <html><head> CSS Demo CSS Demo.bigText { font-size: 3em; font-weight: bold }.smallText { font-size:.75em }</style> 12

Dynamic Styles 2 <!-- function start() { var inputClass = prompt("Enter a css name"); // IE Only // pText.className = inputClass; document.getElementById('pText').className = inputClass; } // --> </script></head> Welcome to our Web page! Welcome to our Web page! </body></html> 13

Dynamic Positioning Another important feature of Dynamic HTML is dynamic positioning, by means of which XHTML elements can be positioned with scripting. Another important feature of Dynamic HTML is dynamic positioning, by means of which XHTML elements can be positioned with scripting. This is done by declaring an element’s CSS position property to be either absolute or relative, and then moving the element by manipulating any of the top, left, right or bottom CSS properties. This is done by declaring an element’s CSS position property to be either absolute or relative, and then moving the element by manipulating any of the top, left, right or bottom CSS properties. 14

Dynamic Positioning <html><head> Dynamic Positioning Dynamic Positioning <!-- var speed = 5; var count = 10; var direction = 1; var firstLine = "Text growing"; var fontStyle = ["serif", "sans-serif", "monospace"]; var fontStylecount = 0; function start() { window.setInterval("run()", 100); } 15

Dynamic Positioning function run() { count += speed; if ((count % 200) == 0) { speed *= -1; direction = !direction; pText.style.color = (speed < 0) ? "red" : "blue"; firstLine = (speed < 0) ? "Text shrinking" : "Text growing"; pText.style.fontFamily = fontStyle[++fontStylecount % 3]; } pText.style.fontSize = count / 3; pText.style.left = count; pText.innerHTML = firstLine + " Font size: " + count + "px"; } 16

Dynamic Positioning // --> </script></head> Welcome!</p></body></html> 17

Object Model Chart 18

Filter and Transitions The difference between Filter and Transition: The difference between Filter and Transition: Applying filters to text and images causes changes that are persistent. Applying filters to text and images causes changes that are persistent. Transitions are temporary Transitions are temporary Filters and transitions do not add content to your pages—rather, they present existing content in an engaging manner to capture the user’s attention Filters and transitions do not add content to your pages—rather, they present existing content in an engaging manner to capture the user’s attention 19

Flip Filter <html><head> <title>Intro</title> body { background-color: #CCFFCC } table { font-size: 3em; font-family: Arial, sans-serif; background-color: #FFCCCC; border-style: ridge; border-collapse: collapse } td { border-style: groove; padding: 1ex } </style></head> 20

Flip Filter <body><table><tr> Text Text <td>Text</td></tr><tr> Text Text </tr></table></body></html> 21

Adding Shadow to Text A simple filter that adds depth to your text is the shadow filter. A simple filter that adds depth to your text is the shadow filter. This filter creates a shadowing effect that gives your text a three-dimensional appearance. This filter creates a shadowing effect that gives your text a three-dimensional appearance. 22

Adding Shadow to Text <html><head> <title>Shadow</title></head><body> Shadow Direction: 0 Shadow Direction: 0 </html> 23

Making Text Glow The glow filter adds an aura of color around text. The glow filter adds an aura of color around text. The color and strength can both be specified as demonstrated in the following code: The color and strength can both be specified as demonstrated in the following code: Glowing Text Glowing Text 24

Other Filter Effects: Gradient To create gradient effects dynamically, using the alpha filter. To create gradient effects dynamically, using the alpha filter. The style property of the filter determines in what style the opacity is applied: The style property of the filter determines in what style the opacity is applied: a value of 0 applies uniform opacity, a value of 0 applies uniform opacity, a value of 1 applies a linear gradient, a value of 1 applies a linear gradient, a value of 2 applies a circular gradient a value of 2 applies a circular gradient and a value of 3 applies a rectangular gradient. and a value of 3 applies a rectangular gradient. The opacity and finishopacity properties are both percentages determining at what percent opacity the specified gradient will start and finish, respectively. The opacity and finishopacity properties are both percentages determining at what percent opacity the specified gradient will start and finish, respectively. 25

Other Filter Effects: blur The blur filter creates an illusion of motion by blurring text or images in a certain direction. The blur filter creates an illusion of motion by blurring text or images in a certain direction. The blur filter can be applied in any of eight directions, and its strength can vary. The blur filter can be applied in any of eight directions, and its strength can vary. The add property, when set to true, adds a copy of the original image over the blurred image, creating a more subtle blurring effect. The add property, when set to true, adds a copy of the original image over the blurred image, creating a more subtle blurring effect. The direction property determines in which direction the blur filter will be applied. This is expressed in angular form (as with the shadow filter). The direction property determines in which direction the blur filter will be applied. This is expressed in angular form (as with the shadow filter). The strength property determines how strong the blurring effect is. The strength property determines how strong the blurring effect is. 26

Transition The transitions included with Internet Explorer give the author control of many scriptable PowerPoint type effects. The transitions included with Internet Explorer give the author control of many scriptable PowerPoint type effects. Transitions are set as values of the filter CSS property, just as regular filters are. Transitions are set as values of the filter CSS property, just as regular filters are. We then use scripting to begin the transition We then use scripting to begin the transition A simple example is the blendTrans transition, which creates a smooth fade-in/fade-out effect. A simple example is the blendTrans transition, which creates a smooth fade-in/fade-out effect. 27

blendTrans <head> Using blendTrans Using blendTrans <!-- function blendOut() { textInput.filters("blendTrans").apply(); textInput.style.visibility = "hidden"; textInput.filters("blendTrans").play();} // --> </script> 28

blendTrans </head><body> Some fading text Some fading text </div></body></html> 29