Dom functions and keyword summaries in javascript

Source: Internet
Author: User
Tags tag name

Properties of the DOM node

Property Description

Attributes array gets all the property subnodes of a node (actually a NodeList object)

The childnodes array gets all the child nodes of a node, can access the child nodes in an array way, and also includes the property length and the method item () (actually a NodeList object)

FirstChild Gets the first child node of a node

LastChild gets the last child node of a node

LocalName returns the local name of the selected element

NextSibling gets the next neighboring child node of a node

PreviousSibling gets the previous neighboring child node of a node

NodeName Gets the node name of a node

NodeType Gets the node type of a node

Ownerdocumend returns the root node of this document

ParentNode returns the parent node of a node

Textcontent and InnerText get a text string for a node (Firefox can only be used with textcontent, other browsers with InnerText)

InnerHTML getting the internal HTML code for a node

BaseURL get the current URL path

Related methods of DOM nodes

Method Description       

AppendChild inserting a new node behind a node

CloneNode Copying a node

HasAttributes determine if a node has an attribute present

InsertBefore inserting a new node in front of a specified child node of a node

Isequalnode determine if two nodes are fully consistent

Issamenode determine if two nodes are the same node

Normalize merges adjacent text objects into a single

RemoveChild Delete (and return) the specified child node of the current node

ReplaceChild replaces the specified child node with a new node for a node, such as Node.replacechild (Newchild,olnode);

GetAttribute gets the value of the specified property of a node

SetAttribute setting the value of a specified property of a node

Method for element Object

Method Description           

getElementById Gets the label node for the specified ID (the document node has this method)

Getelementsbyname the label array for the specified name from a node

Getelemtentsbytagname an array of labels for the specified tag name from a node

Related properties and methods of text objects

Data gets the string of the text node

Length gets the string lengths of the text node

AppendData adds a string after the text node, such as Node.appenddata (string);

DeleteData Delete A string of the specified length at the specified location in the text node

InsertData inserts a string at the specified position in the text node, such as Node.insertdata (start,string);

ReplaceData replaces a string of the specified length at the specified position in the text node, such as Node.replacedata (start,length,string)

Splittext (offset) At the text node specifies the position of the split string as two text nodes, such as node.splittext (offset)

Substringdata extracts a string of the specified length at the specified position in the text node, such as Node.substringdata (Start,length)

Dom functions and keyword summaries in javascript

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.