DOM structure--what relationships may exist between two nodes and how to move between nodes arbitrarily

Source: Internet
Author: User

document.documentelement      returns the root node of the document <HTML>&NBSP;
document.body      <body> 
document.activeelement  returns the tag node (IE)   that is being clicked in the current document;
event.fromelement         return the mouse out of the source node (IE)  
event.toelement         returns the source node (IE)   the mouse is moved into;
event.srcelement      Returns the source node (IE) of the activation event  
event.target          returns the source node of the activation event (Firefox)  
The current object is node 
Returns the parent node: node.parentnode, node.parendelement, 
Returns all child nodes: Node.childnodes (contains text nodes and label nodes), node.children 
Returns the first child node: node.firstchild 
returns the last child node:  node.lastchild 
Returns the same child node: node.nextsibling 
Returns the same as the next child node: node.previoussibling 
Like the parentnode and parentelement functions, childnodes and children function the same. But ParentNode and ChildNodes are in line with the standard, can be said to be more general. And the other two is only IE support, not the standard, Firefox does not support  , so as long as you remember parentelement and children on the line

DOM structure-what relationships may exist between two nodes and how to move between nodes arbitrarily

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.