SlideShare une entreprise Scribd logo
1  sur  21
IPA
1st
Semester, 2007-2008
Internet 1
Ch. 14
Dynamic HTML: Object
Model and Collections
attasr@ipa.edu.sa
09/30/15 © Reem Al-Attas 2
Introduction
 Dynamic HTML Object Model
 Allows Web authors to control the presentation of their
pages
 Gives them access to all the elements on their pages
 Web page
 Elements, forms, frames, tables
 Represented in an object hierarchy
 Scripting
 Retrieve and modify properties and attributes
09/30/15 © Reem Al-Attas 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
 XHTML attributes become properties that can be
manipulated by scripting
09/30/15 © Reem Al-Attas 4
1 <?xml version = "1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5 <!-- Fig. 13.1: reference.html -->
6 <!-- Object Model Introduction -->
7
8 <html xmlns = "http://www.w3.org/1999/xhtml">
9 <head>
10 <title>Object Model</title>
11
12 <script type = "text/javascript">
13 <!--
14 function start()
15 {
16 alert( pText.innerText );
17 pText.innerText = "Thanks for coming.";
18 }
19 // -->
20 </script>
21
22 </head>
Outline
09/30/15 © Reem Al-Attas 5
23
24 <body onload = "start()">
25 <p id = "pText">Welcome to our Web page!</p>
26 </body>
27 </html>
Outline
09/30/15 © Reem Al-Attas 6
Dynamic Styles
 Element’s style can be changed dynamically
 Dynamic HTML Object Model also allows you
to change the class attribute
09/30/15 © Reem Al-Attas 7
1 <?xml version = "1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5 <!-- Fig. 13.4: dynamicstyle.html -->
6 <!-- Dynamic Styles -->
7
8 <html xmlns = "http://www.w3.org/1999/xhtml">
9 <head>
10 <title>Object Model</title>
11
12 <script type = "text/javascript">
13 <!--
14 function start()
15 {
16 var inputColor = prompt(
17 "Enter a color name for the " +
18 "background of this page", "" );
19 document.body.style.backgroundColor = inputColor;
20 }
21 // -->
22 </script>
23 </head>
Outline
09/30/15 © Reem Al-Attas 8
24
25 <body onload = "start()">
26 <p>Welcome to our Web site!</p>
27 </body>
28 </html>
Outline
09/30/15 © Reem Al-Attas 9
1 <?xml version = "1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5 <!-- Fig. 13.5: dynamicstyle2.html -->
6 <!-- More Dynamic Styles -->
7
8 <html xmlns = "http://www.w3.org/1999/xhtml">
9 <head>
10 <title>Object Model</title>
11
12 <style type = "text/css">
13
14 .bigText { font-size: 3em;
15 font-weight: bold }
16
17 .smallText { font-size: .75em }
18
19 </style>
20
Outline
09/30/15 © Reem Al-Attas 10
21 <script type = "text/javascript">
22 <!--
23 function start()
24 {
25 var inputClass = prompt(
26 "Enter a className for the text " +
27 "(bigText or smallText)", "" );
28 pText.className = inputClass;
29 }
30 // -->
31 </script>
32 </head>
33
34 <body onload = "start()">
35 <p id = "pText">Welcome to our Web site!</p>
36 </body>
37 </html>
Outline
09/30/15 © Reem Al-Attas 11
09/30/15 © Reem Al-Attas 12
Using the frames Collection
 Referencing elements and objects in different
frames by using the frames collection
09/30/15 © Reem Al-Attas 13
1 <?xml version = "1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
4
5 <!-- Fig. 13.7: index.html -->
6 <!-- Using the frames collection -->
7
8 <html xmlns = "http://www.w3.org/1999/xhtml">
9 <head>
10 <title>Frames collection</title>
11 </head>
12
13 <frameset rows = "100, *">
14 <frame src = "top.html" name = "upper" />
15 <frame src = "" name = "lower" />
16 </frameset>
17
18 </html>
Outline
09/30/15 © Reem Al-Attas 14
1 <?xml version = "1.0"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5 <!-- Fig. 13.8: top.html -->
6 <!-- Cross-frame scripting -->
7
8 <html xmlns = "http://www.w3.org/1999/xhtml">
9 <head>
10 <title>The frames collection</title>
11
12 <script type = "text/javascript">
13 <!--
14 function start()
15 {
16 var text = prompt( "What is your name?", "" );
17 parent.frames( "lower" ).document.write(
18 "<h1>Hello, " + text + "</h1>" );
19 }
20 // -->
21 </script>
22 </head>
23
Outline
09/30/15 © Reem Al-Attas 15
24 <body onload = "start()">
25 <h1>Cross-frame scripting!</h1>
26 </body>
27 </html>
Outline
09/30/15 © Reem Al-Attas 16
09/30/15 © Reem Al-Attas 17
Summary of the DHTML Object
Model
applets
all
anchors
embeds
forms
filters
images
links
plugins
styleSheets
scripts
frames
plugins
collection
body
screen
document
history
navigator
location
event
document
document
object
window
Key
Fig. 13.10 DHTML Object Model.
09/30/15 © Reem Al-Attas 18
Summary of the DHTML Object
Model
Object or collection Description
Objects
window Represents the browser window and provides access to the document object contained
in the window. If the window contains frames a separate window object is created
automatically for each frame, to provide access to the document rendered in the frame.
Frames are considered to be subwindows in the browser.
document Represents the XHTML document rendered in a window. The document object
provides access to every element in the XHTML document and allows dynamic
modification of the XHTML document.
body Provides access to the body element of an XHTML document.
history Keeps track of the sites visited by the browser user. The object provides a script
programmer with the ability to move forward and backward through the visited sites, but
for security reasons does not allow the actual site URLs to be manipulated.
navigator Contains information about the Web browser, such as the name of the browser, the
version of the browser, the operating system on which the browser is running and other
information that can help a script writer customize the user’s browsing experience.
location Contains the URL of the rendered document. When this object is set to a new URL, the
browser immediately switches (navigates) to the new location.
event Can be used in an event handler to obtain information about the event that occurred (e.g.,
the mouse x-y coordinates during a mouse event).
screen Contains information about the computer screen for the computer on which the browser
is running. Information such as the width and height of the screen in pixels can be used to
determine the size at which elements should be rendered in a Web page.
Fig. 13.11 Objects in the Internet Explorer 6 Object Model.
09/30/15 © Reem Al-Attas 19
Summary of the DHTML Object
Model
Object or collection Description
Collections
all Many objects have an all collection that provides access to every element contained in
the object. For example, the body object’s all collection provides access to every
element in the body element of an XHTML document.
anchors Collection contains all the anchor elements (a) that have a name or id attribute. The
elements appear in the collection in the order they were defined in the XHTML
document.
applets Contains all the applet elements in the XHTML document. Currently, the most
common applet elements are Java applets.
embeds Contains all the embed elements in the XHTML document.
forms Contains all the form elements in the XHTML document. The elements appear in the
collection in the order they were defined in the XHTML document.
frames Contains window objects that represent each frame in the browser window. Each frame
is treated as its own subwindow.
images Contains all the img elements in the XHTML document. The elements appear in the
collection in the order they were defined in the XHTML document.
links Contains all the anchor elements (a) with an href property. This collection also
contains all the area elements that represent links in an image map.
Fig. 13.11 Objects in the Internet Explorer 6 Object Model.
09/30/15 © Reem Al-Attas 20
Summary of the DHTML Object
Model
Object or collection Description
plugins Like the embeds collection, this collection contains all the embed elements in the
XHTML document.
scripts Contains all the script elements in the XHTML document.
styleSheets Contains styleSheet objects that represent each style element in the XHTML
document and each style sheet included in the XHTML document via link.
Fig. 13.11 Objects in the Internet Explorer 6 Object Model.
09/30/15 © Reem Al-Attas 21
Assignment 10
 1) Exercise # 13.7. Due Date for A # 10:
 Next Monday before
your lecture.

Contenu connexe

Tendances (20)

Dhtml
DhtmlDhtml
Dhtml
 
Dhtml ppt (2)
Dhtml ppt (2)Dhtml ppt (2)
Dhtml ppt (2)
 
introduction to the document object model- Dom chapter5
introduction to the document object model- Dom chapter5introduction to the document object model- Dom chapter5
introduction to the document object model- Dom chapter5
 
Dynamic HTML (DHTML)
Dynamic HTML (DHTML)Dynamic HTML (DHTML)
Dynamic HTML (DHTML)
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Introduction to DOM
Introduction to DOMIntroduction to DOM
Introduction to DOM
 
15. session 15 data binding
15. session 15   data binding15. session 15   data binding
15. session 15 data binding
 
XHTML
XHTMLXHTML
XHTML
 
Html and dhtml
Html and dhtmlHtml and dhtml
Html and dhtml
 
Dom structure
Dom structureDom structure
Dom structure
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Dom
DomDom
Dom
 
Understanding the dom by Benedict Ayiko
Understanding the dom by Benedict AyikoUnderstanding the dom by Benedict Ayiko
Understanding the dom by Benedict Ayiko
 
Document Object Model (DOM)
Document Object Model (DOM)Document Object Model (DOM)
Document Object Model (DOM)
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
Introduction to XHTML
Introduction to XHTMLIntroduction to XHTML
Introduction to XHTML
 
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScriptDYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
 
Html css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers workHtml css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers work
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 

Similaire à DHTML - Dynamic HTML

Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTMLReem Alattas
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...goodfriday
 
Silverlight Developer Introduction
Silverlight   Developer IntroductionSilverlight   Developer Introduction
Silverlight Developer IntroductionTomy Ismail
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's GuideKeyur Shah
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMohammad Shaker
 
Meteor + Ionic Introduction
Meteor + Ionic IntroductionMeteor + Ionic Introduction
Meteor + Ionic IntroductionLearningTech
 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering PathRaphael Amorim
 
331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheetstephen972973
 
A I R Presentation Dev Camp Feb 08
A I R  Presentation  Dev Camp  Feb 08A I R  Presentation  Dev Camp  Feb 08
A I R Presentation Dev Camp Feb 08Abdul Qabiz
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi Juhola
 
Polymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele GallottiPolymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele GallottiThinkOpen
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Domkaven yan
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabadCss Founder
 

Similaire à DHTML - Dynamic HTML (20)

Java script
Java scriptJava script
Java script
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Ibm
IbmIbm
Ibm
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
 
New Browsers
New BrowsersNew Browsers
New Browsers
 
Silverlight Developer Introduction
Silverlight   Developer IntroductionSilverlight   Developer Introduction
Silverlight Developer Introduction
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's Guide
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
 
Meteor + Ionic Introduction
Meteor + Ionic IntroductionMeteor + Ionic Introduction
Meteor + Ionic Introduction
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering Path
 
331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
A I R Presentation Dev Camp Feb 08
A I R  Presentation  Dev Camp  Feb 08A I R  Presentation  Dev Camp  Feb 08
A I R Presentation Dev Camp Feb 08
 
Html frames
Html framesHtml frames
Html frames
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
Polymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele GallottiPolymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele Gallotti
 
The Theory Of The Dom
The Theory Of The DomThe Theory Of The Dom
The Theory Of The Dom
 
Website designing company in faridabad
Website designing company in faridabadWebsite designing company in faridabad
Website designing company in faridabad
 

Plus de Reem Alattas

Rumble Lights Pitch Deck
Rumble Lights Pitch DeckRumble Lights Pitch Deck
Rumble Lights Pitch DeckReem Alattas
 
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular RobotsNASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular RobotsReem Alattas
 
She looks just like me 2017
She looks just like me 2017She looks just like me 2017
She looks just like me 2017Reem Alattas
 
Nasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space ExplorationNasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space ExplorationReem Alattas
 
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space ExplorationNasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space ExplorationReem Alattas
 
She Looks Just Like Me 2017
She Looks Just Like Me 2017She Looks Just Like Me 2017
She Looks Just Like Me 2017Reem Alattas
 
Evolutionary Algorithms
Evolutionary AlgorithmsEvolutionary Algorithms
Evolutionary AlgorithmsReem Alattas
 
Evolutionary Robotics
Evolutionary RoboticsEvolutionary Robotics
Evolutionary RoboticsReem Alattas
 
Enhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceEnhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceReem Alattas
 
Skinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input SurfaceSkinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input SurfaceReem Alattas
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup LanguageReem Alattas
 
Dynamic HTML Event Model
Dynamic HTML Event ModelDynamic HTML Event Model
Dynamic HTML Event ModelReem Alattas
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript ObjectsReem Alattas
 
Linear Search & Binary Search
Linear Search & Binary SearchLinear Search & Binary Search
Linear Search & Binary SearchReem Alattas
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays Reem Alattas
 
JavaScript Functions
JavaScript Functions JavaScript Functions
JavaScript Functions Reem Alattas
 
JavaScript Control Statements II
JavaScript Control Statements IIJavaScript Control Statements II
JavaScript Control Statements IIReem Alattas
 

Plus de Reem Alattas (20)

Rumble Lights Pitch Deck
Rumble Lights Pitch DeckRumble Lights Pitch Deck
Rumble Lights Pitch Deck
 
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular RobotsNASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
NASA Datanauts Water Cooler Chat: Autonomous Design of Modular Robots
 
She looks just like me 2017
She looks just like me 2017She looks just like me 2017
She looks just like me 2017
 
Nasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space ExplorationNasa Datanauts Water Cooler Chat: Robotics for Space Exploration
Nasa Datanauts Water Cooler Chat: Robotics for Space Exploration
 
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space ExplorationNasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
Nasa Datanauts Water Cooler Chat: Evolutionary Robots for Space Exploration
 
She Looks Just Like Me 2017
She Looks Just Like Me 2017She Looks Just Like Me 2017
She Looks Just Like Me 2017
 
Tran helmet pitch
Tran helmet pitchTran helmet pitch
Tran helmet pitch
 
Evolutionary Algorithms
Evolutionary AlgorithmsEvolutionary Algorithms
Evolutionary Algorithms
 
Evolutionary Robotics
Evolutionary RoboticsEvolutionary Robotics
Evolutionary Robotics
 
Create a Need
Create a NeedCreate a Need
Create a Need
 
Enhancing input on and above the interactive surface
Enhancing input on and above the interactive surfaceEnhancing input on and above the interactive surface
Enhancing input on and above the interactive surface
 
Skinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input SurfaceSkinput: Appropriating the Body as an Input Surface
Skinput: Appropriating the Body as an Input Surface
 
XML - EXtensible Markup Language
XML - EXtensible Markup LanguageXML - EXtensible Markup Language
XML - EXtensible Markup Language
 
Dynamic HTML Event Model
Dynamic HTML Event ModelDynamic HTML Event Model
Dynamic HTML Event Model
 
PHP Scripting
PHP ScriptingPHP Scripting
PHP Scripting
 
JavaScript Objects
JavaScript ObjectsJavaScript Objects
JavaScript Objects
 
Linear Search & Binary Search
Linear Search & Binary SearchLinear Search & Binary Search
Linear Search & Binary Search
 
JavaScript Arrays
JavaScript Arrays JavaScript Arrays
JavaScript Arrays
 
JavaScript Functions
JavaScript Functions JavaScript Functions
JavaScript Functions
 
JavaScript Control Statements II
JavaScript Control Statements IIJavaScript Control Statements II
JavaScript Control Statements II
 

Dernier

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Dernier (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

DHTML - Dynamic HTML

  • 1. IPA 1st Semester, 2007-2008 Internet 1 Ch. 14 Dynamic HTML: Object Model and Collections attasr@ipa.edu.sa
  • 2. 09/30/15 © Reem Al-Attas 2 Introduction  Dynamic HTML Object Model  Allows Web authors to control the presentation of their pages  Gives them access to all the elements on their pages  Web page  Elements, forms, frames, tables  Represented in an object hierarchy  Scripting  Retrieve and modify properties and attributes
  • 3. 09/30/15 © Reem Al-Attas 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  XHTML attributes become properties that can be manipulated by scripting
  • 4. 09/30/15 © Reem Al-Attas 4 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 4 5 <!-- Fig. 13.1: reference.html --> 6 <!-- Object Model Introduction --> 7 8 <html xmlns = "http://www.w3.org/1999/xhtml"> 9 <head> 10 <title>Object Model</title> 11 12 <script type = "text/javascript"> 13 <!-- 14 function start() 15 { 16 alert( pText.innerText ); 17 pText.innerText = "Thanks for coming."; 18 } 19 // --> 20 </script> 21 22 </head> Outline
  • 5. 09/30/15 © Reem Al-Attas 5 23 24 <body onload = "start()"> 25 <p id = "pText">Welcome to our Web page!</p> 26 </body> 27 </html> Outline
  • 6. 09/30/15 © Reem Al-Attas 6 Dynamic Styles  Element’s style can be changed dynamically  Dynamic HTML Object Model also allows you to change the class attribute
  • 7. 09/30/15 © Reem Al-Attas 7 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 4 5 <!-- Fig. 13.4: dynamicstyle.html --> 6 <!-- Dynamic Styles --> 7 8 <html xmlns = "http://www.w3.org/1999/xhtml"> 9 <head> 10 <title>Object Model</title> 11 12 <script type = "text/javascript"> 13 <!-- 14 function start() 15 { 16 var inputColor = prompt( 17 "Enter a color name for the " + 18 "background of this page", "" ); 19 document.body.style.backgroundColor = inputColor; 20 } 21 // --> 22 </script> 23 </head> Outline
  • 8. 09/30/15 © Reem Al-Attas 8 24 25 <body onload = "start()"> 26 <p>Welcome to our Web site!</p> 27 </body> 28 </html> Outline
  • 9. 09/30/15 © Reem Al-Attas 9 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 4 5 <!-- Fig. 13.5: dynamicstyle2.html --> 6 <!-- More Dynamic Styles --> 7 8 <html xmlns = "http://www.w3.org/1999/xhtml"> 9 <head> 10 <title>Object Model</title> 11 12 <style type = "text/css"> 13 14 .bigText { font-size: 3em; 15 font-weight: bold } 16 17 .smallText { font-size: .75em } 18 19 </style> 20 Outline
  • 10. 09/30/15 © Reem Al-Attas 10 21 <script type = "text/javascript"> 22 <!-- 23 function start() 24 { 25 var inputClass = prompt( 26 "Enter a className for the text " + 27 "(bigText or smallText)", "" ); 28 pText.className = inputClass; 29 } 30 // --> 31 </script> 32 </head> 33 34 <body onload = "start()"> 35 <p id = "pText">Welcome to our Web site!</p> 36 </body> 37 </html> Outline
  • 11. 09/30/15 © Reem Al-Attas 11
  • 12. 09/30/15 © Reem Al-Attas 12 Using the frames Collection  Referencing elements and objects in different frames by using the frames collection
  • 13. 09/30/15 © Reem Al-Attas 13 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> 4 5 <!-- Fig. 13.7: index.html --> 6 <!-- Using the frames collection --> 7 8 <html xmlns = "http://www.w3.org/1999/xhtml"> 9 <head> 10 <title>Frames collection</title> 11 </head> 12 13 <frameset rows = "100, *"> 14 <frame src = "top.html" name = "upper" /> 15 <frame src = "" name = "lower" /> 16 </frameset> 17 18 </html> Outline
  • 14. 09/30/15 © Reem Al-Attas 14 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 4 5 <!-- Fig. 13.8: top.html --> 6 <!-- Cross-frame scripting --> 7 8 <html xmlns = "http://www.w3.org/1999/xhtml"> 9 <head> 10 <title>The frames collection</title> 11 12 <script type = "text/javascript"> 13 <!-- 14 function start() 15 { 16 var text = prompt( "What is your name?", "" ); 17 parent.frames( "lower" ).document.write( 18 "<h1>Hello, " + text + "</h1>" ); 19 } 20 // --> 21 </script> 22 </head> 23 Outline
  • 15. 09/30/15 © Reem Al-Attas 15 24 <body onload = "start()"> 25 <h1>Cross-frame scripting!</h1> 26 </body> 27 </html> Outline
  • 16. 09/30/15 © Reem Al-Attas 16
  • 17. 09/30/15 © Reem Al-Attas 17 Summary of the DHTML Object Model applets all anchors embeds forms filters images links plugins styleSheets scripts frames plugins collection body screen document history navigator location event document document object window Key Fig. 13.10 DHTML Object Model.
  • 18. 09/30/15 © Reem Al-Attas 18 Summary of the DHTML Object Model Object or collection Description Objects window Represents the browser window and provides access to the document object contained in the window. If the window contains frames a separate window object is created automatically for each frame, to provide access to the document rendered in the frame. Frames are considered to be subwindows in the browser. document Represents the XHTML document rendered in a window. The document object provides access to every element in the XHTML document and allows dynamic modification of the XHTML document. body Provides access to the body element of an XHTML document. history Keeps track of the sites visited by the browser user. The object provides a script programmer with the ability to move forward and backward through the visited sites, but for security reasons does not allow the actual site URLs to be manipulated. navigator Contains information about the Web browser, such as the name of the browser, the version of the browser, the operating system on which the browser is running and other information that can help a script writer customize the user’s browsing experience. location Contains the URL of the rendered document. When this object is set to a new URL, the browser immediately switches (navigates) to the new location. event Can be used in an event handler to obtain information about the event that occurred (e.g., the mouse x-y coordinates during a mouse event). screen Contains information about the computer screen for the computer on which the browser is running. Information such as the width and height of the screen in pixels can be used to determine the size at which elements should be rendered in a Web page. Fig. 13.11 Objects in the Internet Explorer 6 Object Model.
  • 19. 09/30/15 © Reem Al-Attas 19 Summary of the DHTML Object Model Object or collection Description Collections all Many objects have an all collection that provides access to every element contained in the object. For example, the body object’s all collection provides access to every element in the body element of an XHTML document. anchors Collection contains all the anchor elements (a) that have a name or id attribute. The elements appear in the collection in the order they were defined in the XHTML document. applets Contains all the applet elements in the XHTML document. Currently, the most common applet elements are Java applets. embeds Contains all the embed elements in the XHTML document. forms Contains all the form elements in the XHTML document. The elements appear in the collection in the order they were defined in the XHTML document. frames Contains window objects that represent each frame in the browser window. Each frame is treated as its own subwindow. images Contains all the img elements in the XHTML document. The elements appear in the collection in the order they were defined in the XHTML document. links Contains all the anchor elements (a) with an href property. This collection also contains all the area elements that represent links in an image map. Fig. 13.11 Objects in the Internet Explorer 6 Object Model.
  • 20. 09/30/15 © Reem Al-Attas 20 Summary of the DHTML Object Model Object or collection Description plugins Like the embeds collection, this collection contains all the embed elements in the XHTML document. scripts Contains all the script elements in the XHTML document. styleSheets Contains styleSheet objects that represent each style element in the XHTML document and each style sheet included in the XHTML document via link. Fig. 13.11 Objects in the Internet Explorer 6 Object Model.
  • 21. 09/30/15 © Reem Al-Attas 21 Assignment 10  1) Exercise # 13.7. Due Date for A # 10:  Next Monday before your lecture.