DOM Exercise - JavaScript and the Document Object Model...

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

View Full Document Right Arrow Icon
Here is a very partial list of methods and properties that allow you to access and manipulate the DOM. document.getElementById ( idname ): returns the node with id idname document.getElementsByTagName ( tag ): returns an array of nodes in the document with the tag tag E.g. var node = document.getElementByID(“photoid”); var nodearray = document.getElementsByTagname(“img”); mynode . firstChild : gives the first child node of mynode mynode . lastChild : gives the last child node of mynode mynode . parentNode : gives the parent node of mynode mynode . childNodes : gives an array of nodes consisting of the children (in order) of mynode Here are some examples of properties that can be altered in the DOM. myimgnode . src : the src file of an image tag mytextnode . nodeValue : the string of the text contained in a text node mytextinput . value : the string of text entered in a text input area mynode . style.color
Background image of page 1

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

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

This note was uploaded on 04/01/2008 for the course INFO 2300 taught by Professor Williamson during the Spring '08 term at Cornell University (Engineering School).

Page1 / 6

DOM Exercise - JavaScript and the Document Object Model...

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

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