laitimes

5. How dom structure operations add, remove, move, copy, create, and find nodes

author:Chi Zi Mu

How do dom structure operations add, remove, move, copy, create, and find nodes? (Must Meet)

1. Create a new node

createDocumentFragment( ) // Creates a DOM fragment

createElement( ) // Creates a concrete element

createTextnode( ) // Creates a text node

2. Add, remove, replace, insert

appendChild( )

removeChild( )

replaceChild( )

insertBefore( ) // and no insertAfter()

3. Find

getElementsByTagName( ) // by tag name

getElementsByName( ) // Via the value of the element's Name attribute (IE is more fault tolerant and results in an array that includes an id equal to the name value)

getElementById( ) // Uniqueness through element Id

Read on