October 21, 2006
October 06 Meeting – DOM Properties
Children, parents and siblings decribe the relationships for the current element in the DOM tree and whether it contains other elements or not. Every node in the document has several properties such as nodeType which describes what the node is and nodeName which is the name of the elementor and finally nodeValue which is the value of the node, null if it is an element.
In the case of text nodes, nodeValue can be read and set, which allows you to alter the text content of the element. If for example, you wanted to change the text of the first paragraph, you would have to access the text node inside in it, in other words, the first child node of the paragraph:
getElementsByTagName(‘p’)[0].firstChild.nodeValue = ‘Hello’;
The firstChild property can be used as a shortcut. Every element can have any number of children, listed in a property called childNodes. Here is an article (.pdf) by Tom Dell’Aringa that covers nodes in more detail as well as other topics we will cover in upcoming meetings.
Most of our future examples will use techniques covered today and last month. So….practice, practice, practice.
Posted in:
·JavaScript
·Meeting notes
Site Related
·Home
·About
·Downloads
·Resource Links
·Archives
·Contact Me
·Subscribe for Updates
My Classes
Categories
·ASP.NET (5)
·CSS (7)
·Dreamweaver (2)
·Flash (7)
·Fun (1)
·HTML (2)
·Interviews (4)
·JavaScript (43)
·jQuery (4)
·LVS Online Classes (3)
·Meeting notes (20)
·PHP (7)
·Podcasts (7)
·Video tutorials (19)
·Web stuff (16)
Search
Popular Tags
ActionScript 3.0 Ajax Apache ASP ASP.NET blogging Class Classes and Training CSS Database DOM Dreamweaver Expression Web Firefox Flash FOWD FrontPage Functions Hover Effect Image Manipulation Interview JavaScript Jeremy Keith jQuery Learning libraries LVSOnline MySQL Objects OOP PHP Podcast Podcasts Presentational Markup presentations Refresh06 Styling Unobtrusiveness video tutorials web conference WordPress writting code XHTML XML XSLT
Notable Blogs
·Aaron Newton
·Ajaxian
·Alex King
·Andy Budd
·Andy Clarke
·Andy Rutledge
·Bob Easton
·Brian Goldfarb
·Cameron Adams
·Cameron Moll
·Chris Heilmann
·CNET TV
·Dan Simard
·Dan Wahlin
·David Stiller
·Dori Smith
·Dustin Diaz
·Eric Meyer
·Geek Entertainment TV
·Geoff Stearns
·Independents Hall
·Jacob Seidelin
·James Edwards
·Jeremy Keith
·Jesse Skinner
·John Musser
·John Resig
·Jonathan Christopher
·Jonathan Snook
·Justin Palmer
·Kevin Miller
·Michael Mahemoff
·Milan Negovan
·Molly Holzschlag
·Nate Koechley
·Paul Boag
·Peter-Paul Koch
·Robert Nyman
·Roger Johansson
·Samuel Ryan
·Sarah Lacy
·Saul Rosenbaum
·Scott Andrew LePera
·Scott Guthrie
·Scott Mitchell
·Scott Schiller
·Shaun Inman
·Steve Sharrock
·Tina Su
·WebAppers
My Flickr