The JavaScript node

Source: Internet
Author: User

One, the JavaScript node is dynamic to get the name of the element, in order to do the element operation, in node has two methods to use, the first method is NodeType, the second method is nodename, both methods can be used to manipulate elements.

1. NodeType syntax------It is to manipulate elements by judging the type of the element, for example, the div element is an element, that is, it is possible to judge the elements, and if the elements are element, the return result is true, or it can be manipulated at this point.

2, nodename syntax-----It is through the name of the element to determine the operation of the element, such as a div its ID name is called one, then when the judgment is written nodename== "one", and then by the method of obtaining a variable to manipulate the element. Note: The name of the element must be the ID name can be and the name of the element to be capitalized, in time to write the use of lowercase, but the judgment must be capitalized, otherwise it will not perform the effect.

3. The top-level Document object syntax for obtaining the current document is owndocument.

4. The latter document object that is used to obtain the current document sibling.

5. The previous document object that is used to obtain the current object's sibling.

The JavaScript node

Related Article

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.