




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Students of Communication, study E-Commerce as an auxiliary subject. these are the key points discussed in these Lecture Slides of E-Commerce : Document Object Model , Models Document, Hierarchical Structure, Varying Complexity, Node Relationships, Child, Parent, Sibling, Property Childnodes, Element Nodes
Typology: Slides
1 / 8
This page cannot be seen from the preview
Don't miss anything!





1
Models document (XHTML, XML, etc.) in a hierarchical structure. AllAllows programmaticti parsingi andd changingh i off th the document. Multiple "methods of attack" of varying complexity.
2
Hello</hello>
Document Element: html
<body> El^ t h^ d <p>Hi there!</p> </body> </html>
Element: head
Element: body
Element: title Text: Hello
Element: pp Text: Hi there!
A document is a collection of nodes of varying type. Nodes can contain other nodes. <p style="special">Thisl " i l" hi ii s text.</p>/ Element node —XHTML tag Text node —textual content of document. Contained within element nodes. Attribute nodeAttribute node —provides more information about provides more information about an element.
4
element.getAttribute(attribute) —returns attribute value for the element http://einstein etsu edu/~pittares/CSCI3110/examples/8 3 htmhttp://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐ 3 .htm element.setAttribute(attribute, value) —sets/resets the attribute value for the element http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐4.htm http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐5.htm http://webbugtrack.blogspot.com/2007/08/bug‐ 242 ‐setattribute‐doesnt‐always‐work.html
An element node's text can be read and modified using the innerHTML property. http://einstein etsu edu/~pittares/CSCI3110/examples/8 6 htmhttp://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐ 6 .htm innerHTML sees/sets the entire contents of the specified element, including other embedded tags/elements. http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐7.htm
5
In the context of DOM, an element is an object. It may or may not have a toString method defined. http://einstein etsu edu/~pittares/CSCI3110/examples/8 8 htmhttp://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐ 8 .htm http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐9.htm
All nodes in a document are related. Relationship types: ChildChild Parent Sibling Each node has a property childNodes which contain an array‐like list of children. http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐10.htm ThiThis li tlist containst i allll t t ypes off nodes,d nott j j ustt elementl t nodes. http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐11.htm
7
New elements can be added to a document by creating a new elements, building its contents, and adding it whereadding it where appropriate in the documentappropriate in the document hierarchy. element .appendChild(element) http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐15.htm
DOM events can be added to elements: http://en.wikipedia.org/wiki/DOM_events HHave eventt h h andlerdl returnt f lfalse tt o preventt f f urtherth default event handling. http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐16.htm http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐17.htm
8
The document object contains arrays (as properties) to each access to certain page elements: dd ocument.anchorst h —allll namedd anchorsh withinithi a document document.forms —all forms within a document document.images —all images within a document document.linksdocument.links —all all hyperlinks within a document hyperlinks within a document http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐18.htm
The document object contains properties to each access to certain page elements: bodybody —reference e e e ce to body e e to body element e t cookie —sets/reads cookies associated with document domain —domain name for current document lastModified —date/time document last modified referrer —URL that referred to current document title —title of current document URL —URL of current document http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐19.htm http://einstein.etsu.edu/~pittares/CSCI3110/examples/8‐20.htm