JavasSummary statement for getting HTML Dom node elements !!, This article is intended for othersArticle, Because it is easy to use, it feels very practical, so it has been used for future use !!Thank you for your original author !!!,For Web
Dom node type, which is useful in traversal and can be used to filter nodes that do not care about.
For example:
Function showpageattr () {var divimgshowarea = document. getelementbyid ('divimgshowarea '); var nodes = divimgshowarea. childnodes;
Dom definitionThe DOM (Document Object model) is an API (application programming Interface) for HTML and XML documents, derived from Netscape and Microsoft's founding DHTML (Dynamic HTML). The DOM depicts a hierarchical tree of nodes that allows
The visual format model of CSS is an algorithm that processes the document and displays it in a visual medium. It is the basic concept of CSS, the visual format model transforms each document element, and generates 0 or one or more boxes that
This is the story of the previous whim to manipulate the form with the DOM node's relationship ...Things are like this, is probably a platform after the registration of the message function, the administrator can log in after the message to reply.
HTML Dom tutorial 5-html Dom node access
1: common methods for finding and accessing nodes
Use the getelementbyid () and getelementsbytagname () methods;
Use the parentnode, firstchild, and lastchild attributes of an element node;
1. Get through the top-level document node:(1) document.getElementById (ElementID): Gets the node by ID, if the page contains more than one node with the same ID, then only the first node is returned.(2) Document.getelementsbyname (elementname):
JS DOM node:The relationship of a node in the JS DOM is defined as the attribute of the node:There are usually the following types of relationships between nodes:(The relationship here is supported by all browsers)
ParentNode parent Node
Get and set content: Text (), HTML (), and Val ()
Text ()-Sets or returns the text content of the selected element
HTML ()-Sets or returns the contents of the selected element (including HTML tags)
Val ()-Sets or returns the value
All nodesIn the HTML DOM (Document Object model), nodes mainly include (numbers in parentheses denote node types): Elements (1), Attributes (2), text (3, where line breaks are also a text node), comments (8),文档(9)。The main application of these
A list of jquery operation node methods was found on the Internet. As follows:
Method
Source Wrapper Set/String
Target Packaging Group
Feature description
A.append (B)
B
A
If the target
This article mainly introduces jQuery's filter () method for Traversing DOM node operations. It analyzes the filter function and four usage methods in detail based on the instance form, for more information about how to use jQuery to traverse DOM
JavaScript DOM node operation instance Summary (new, delete HTML elements), javascriptdom
This article describes how to operate JavaScript DOM nodes. We will share this with you for your reference. The details are as follows:
You can use DOM to
Document Fruit Unit Price (¥) Apple 54.5 oranges 24.5 Watermelon 33.8 Banana 13.8Every day a JS small demo form sort. Key points of knowledge: form manipulation in the DOM, node manipulation
1.For example: node Tree Student Information name Sex Age The child nodes of HTML are body and head while body and head are two sibling nodes, and the parent node is HTML. The child node of head is the title.2. Accessing the specified element
1. How to get nodes:1) Get the node through the top layer:document.getElementById (""); Gets the attribute value of the node by ID. Note: If you have more than one node with the same ID, only the first node is returnedDocument.getelementsbyname ("");
Mainly include: Document.getelementbyid,getelementsbyclassname,getelementsbytagname,getelementsbynameFunction name notation: Getelementsbyclassname, getElementsByTagName is elements!!! With s!!! getElementById's not s~~.return value:
Append (Content | fn): appends content to each matching element. Reference: http://jquery.cuishifeng.cn/append.htmlFor example, append some HTML tags to all the paragraphs. i would like to say: $ ("P"). Append ("Hello"); [i would like to say:
Recently read the "JavaScript Object-oriented Programming Guide" This book, reading the browser environment chapter, gradually understand that JS as a scripting language, need to rely on the host environment to implement the function, from the
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.