L17-JavaScript2

L17-JavaScript2 - Session 17 JavaScript (Part 2) Session 17...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Session 17 – JavaScript (Part 2) 11/15/2010 1 © Robert Kelly, 2001-2010 Session 17 JavaScript Part 2 1 W3C DOM Reading and Reference Background and introduction www.w3schools.com/HTMLDOM/default.asp Reading – a good tutorial on the use of W3C DOM to modify html www.builderau.com.au/program/javascript/soa/Ac cessing-form-data-via-JavaScript-and-the- DOM/0,339028434,339277582,00.htm Reference © Robert Kelly, 2001-2010 2 Reference: JavaScript DOM properties – Flanagan book and www.javascriptkit.com/ W3C General spec – www.w3.org/TR/DOM-Level-2/core.html
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Session 17 – JavaScript (Part 2) 11/15/2010 2 © Robert Kelly, 2001-2010 Learning Goals Understand the Document Object Model Understand how to perform client side form validation © Robert Kelly, 2001-2010 3 Access to the Document JavaScript begins to be useful when you can access and modify the html in the document Ah Approaches Legacy DOM (Document Object Model) – Defined by Netscape in the early days of the WWW IE 4 DOM – still in use, although Microsoft now supports W3C DOM W3C DOM ll t d d b © Robert Kelly, 2001-2010 4 well supported on modern browsers Includes the legacy DOM (known as Level 0 DOM) You may see the use of many of the supported DOMs in current code
Background image of page 2
Session 17 – JavaScript (Part 2) 11/15/2010 3 © Robert Kelly, 2001-2010 Legacy DOM Does not take full advantage of the tree structure of html documents Tends to reference html elements as members of an array, for example images[], links[] and forms[] Naming <form name=“f1”> © Robert Kelly, 2001-2010 document.forms[0] document.forms.f1 document.forms[“f1”] 5 Assuming the order of elements in an html document can cause maintenance problems W3C DOM Defines a standard set of objects (object tree) for an html document Set of methods (language independent) to access the html object Your Java and JavaScript (and other) programs can Access a given node (element) © Robert Kelly, 2001-2010 6 Walk the tree Search for particular nodes or data (e.g., img tags) Modify the nodes and insert sub-trees Current version is DOM Level 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2011 for the course CSE 336 taught by Professor Kelly,r during the Fall '08 term at SUNY Stony Brook.

Page1 / 11

L17-JavaScript2 - Session 17 JavaScript (Part 2) Session 17...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online