JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes...
-
Upload
aubrie-watson -
Category
Documents
-
view
212 -
download
0
Transcript of JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes...
![Page 1: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/1.jpg)
JavaScript and The Document Object Model
MMIS 656 Web Design Technologies
Acknowledgements: 1. Notes from David Shrader, NSU GSCIS2. Some material adapted from Conallen, Building Web Applications with UML.
![Page 2: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/2.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 2
Objectives
Document Object Model (DOM) JavaScript Language JavaScript Practice Exercise 5
![Page 3: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/3.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 3
Dynamic Clients
Originally driven by need to enhance the user interface rendered by web pages.
Can also be used to implement some business logic functions.
Key is the ability to make Web page content accessible to scripts and modules on the client
![Page 4: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/4.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 4
Document Object Model
Platform-neutral interface to the browser and the HTML document
Common API for developers to manipulate the content
Programs and scripts can dynamically access and update document content, structure, and style
Browser is now responsible for rendering the HTML page which could be changed AND execution of scripts and compiled programs specified by the page.
![Page 5: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/5.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 5
Document Object Model
Three principle goals Interfaces and objects used to represent
and manipulate a document Semantics of these interfaces and object,
including both behavior and attributes Relationships and collaborations among
these interfaces and objects.
![Page 6: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/6.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 6
The DOM Interface
Browser
HTML
Script
Compiledmodules
DOM
![Page 7: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/7.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 7
DOM Example
<body><p>The new HTML 4.0 specification
includes support for</p><ul>
<li>Style sheets</li><li>Internationalization</li><li>Tables and Forms</li><li>Scripting and multimedia</li>
</ul></body>
![Page 8: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/8.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 8
Class Diagram of Document
Body
Paragraph UnOrderedList
List itemFigure only presents a subset of model.
![Page 9: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/9.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 9
Object (Instance) Diagram: Body
: Paragraph
The new HTML 4.0 specification includes additional support for
: UnOrderedList
: ListItem
Scripting and multimedia
: ListItem
Internationalization
: ListItem
Tables and Forms
: ListItem
Style sheets
![Page 10: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/10.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 10
The DOM Hierarchy
window
frame
document
location
history
layer
link
image
area
anchor
applet
form
text
hidden
reset
radio
checkbox
button
select
password
submit
option
![Page 11: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/11.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 11
JavaScript
Most common scripting technology in browsers (VBScript is also available)
Resembles Java but discards Java’s type checking
Object-based (not Object-oriented) Interpreted, not compiled Dynamic binding and runtime checking Easier than programming
![Page 12: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/12.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 12
JavaScript Uses
Validating form entries Window popup Detect browser type and version Conditional redirection to another URL Get, set, and delete cookies Date and time Simple tools (i.e., loan calculator)
![Page 13: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/13.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 13
JavaScript Basics
Usually placed directly in HTML document
Can be either in head (preferred) or body
Placed within <script> block tags Use HTML comment tags for
compatibility with older browsers
![Page 14: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/14.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 14
JavaScript Example
<SCRIPT LANGUAGE=“JavaScript”>
<!--alert(‘Hello, World!’)
-->
</SCRIPT>
![Page 15: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/15.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 15
JavaScript Features
User-defined functions Conditional logic (if/then/else) DOM and JavaScript Objects Events and Event Handlers
![Page 16: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/16.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 16
Events Abort
User aborts loading of an image
Blur User removes input focus from
window, frame, or form element Click
User clicks from element or link Change
User changes value of element Error
Loading a document causes an error
Focus User gives input focus to
window, frame, or form element
Load User loads the page
Mouseout User moves mouse pointer out of an
area or link Mouseover
User moves mouse point over a link Reset
User resets a form Select
User selects from element’s input field
Submit User submits a form
Unload User exits the page.
![Page 17: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/17.jpg)
JavaScript Examples
(In-class Demonstration)
![Page 18: JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.](https://reader036.fdocuments.in/reader036/viewer/2022072011/56649e175503460f94b03483/html5/thumbnails/18.jpg)
S5: July 23, 2003 MMIS 656 / Session 5 18
Next Class
Web site design and planning Readings:
Review Shiple Information Architecture Article.