JS-to-node operation methodI. Access1. Getting the parent nodeThe ParentNode property value of a node is the parent node of the node. Example:var parent = document.getElementById ("one"). parentnode;2. Acquisition of sibling nodesThe
Js gets the implementation method of all the sibling nodes of the element. js nodes
For example, there are 10 li in a ul, and 3rd li have special styles (for example, the color is red and others are black ). I want to set the color of all other
var chils= s.childnodes; Get all of S's sub nodes var
par=s.parentnode//Get S's parent node var ns=s.nextsbiling;//Get S's
next sibling node
var ps= s.previoussbiling; Get the last sibling of S of var fc=s.firstchild;//Get the
first child node of s
The TreeView component is defined by multiple classes, and the TreeView component is defined by the TreeView class in the Namespace "System.Windows.Forms", where the node (that is, nodes) is created by the namespace "TreeNode" in
ParentNode (): Enter the parent node of the current node; firstChild (): Enter the first child node of the current node; lastChild (): Enter the last child node nextSibling () of the current node (): enter the next sibling node of the current node
I. DOM Basics1. node levelDocument-the top-level node. All other nodes are attached to it.DocumentType -- DTD reference (use syntax). It cannot contain subnodes.DocumentFragment -- other nodes can be saved like a Document.Element -- indicates the
Because DOM is a tree structure, a Node is abstracted as an object Node, which is the core object of DOM. There are 12 types of nodes. The value of Node. nodeType is 1-12 ).
BKJIA recommended reading: The nature and operation methods of JavaScript
This article describes in detail how to obtain node sibling, parent, and child elements in JS. If you need a friend, refer to it, I hope it will be helpful for you to first talk about the JS acquisition method, which is much more troublesome than
There are three types of nodes in the DOM summary (a): element nodes, attribute nodes, text nodes, three nodes have the same three properties, and the element node can get the parent and child nodes of the current node. At the same time, the node
Interface
NodeType constant
NodeType Value
Remarks
Element
Node. ELEMENT_NODE
1
Element Node
Text
Node. TEXT_NODE
3
Text Node
Document
Node. DOCUMENT_NODE
9
Document
Summary of Common elements finding methods in jquery$ ("#myELement") select an element with an ID value equal to myelement, the ID value cannot be duplicated in the document only one ID value is myelement so get the unique element$ ("div")
1. Get the Document object.A.queryselector (): By passing in a legitimate CSS selector, you get the first element that meets the criteria.Document.queryselector ("#test"); Returns the first element with ID test;B.queryselectorall (): By passing
Without authorization, shall not be reproduced privately, or be held liableContact author [email protected] get authorizationReprint please indicate the author and sourceMany of the online red and black trees are not analyzed clearly insert delete
1,Node object Element and Document Object inherit from him
Attribute name/method name
Function
ChildNodes
ReturnsNodeList objectIt can also be seen as an array, which indicates all the subnodes under the Node object that
The file object model (DOM) is an application interface (API) that represents the various elements of a document (such as HTML and XML) and accesses and operations ). Generally, all browsers that support Javascript support DOM. The DOM involved in
EXT class
Addbehaviors (Object OBJ): void
Apply the event listener to the selected element. The event name ends with @, for example
Addbehaviors ({
// Id = Add a click event to all a tags under foo
'# Foo A @ click': function (E, T ){
// Do
During the development of the gix4 project, a complicated data structure is encountered. Complicated because it has many restrictions. My job is to add new features in the existing system and refactor some of the old features in the process.Code.
Php xml operation class domdocument attributes and MethodsNote that case sensitivity must not be incorrect.
Attribute:
Attribute list of the attributes storage node (read-only)
List of child nodes of the childnodes storage node (read-only)
This section provides a lot of handy ways to manipulate the DOM, including the famous $ method, the Document.getelementsbyclassname method, and the element object, the insertion object
The following sections provide a detailed description of one:
$
The JavaScript front-end Framework (package Library) Beta 5.0 was officially released on October 10, and today the API reference for Beta 5.0 is now available. Compared to the previous 5 releases are a cursory source code, and not many people
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.