Have some free time recently, want to learn the front-end things on the plan to start with JavaScript. While reading a book, jot down notes.JavaScript built-in objectsHide and show:Syntax: Object.style.display = valueNote: object is an element that
This article summarizes the JavaScript node and the method of list operation. Share to everyone for your reference. Specifically as follows:
(1) Create a new node
Createdocumentfragment ()//Create a DOM fragment
createelement ()//create a
We know that a complete JavaScript implementation needs to consist of three parts: ECMAScript (Core), BOM (Browser object model), DOM (Document Object model).
Today the main learning BOM and DOM.
Bom:
The BOM provides a lot of objects to access
Object method: getElementsByTagName () returns a list of nodes (a collection/node array) that contains all the elements with the specified label name. Getelementsbyclassname () returns a list of nodes that contain all the elements with the specified
Javascript learning note node operation implementation code, including creating, adding, removing, replacing, and copying nodes.
The Code is as follows:
Project 1
Project 2
Project 3
1. Create an element node
The document.
Html dom tutorial, html dom tutorialHTML DOM
DOM tutorial
Introduction to DOM
DOM Node
DOM method
DOM attributes
DOM access
DOM Modification
DOM content
DOM Element
DOM events
DOM navigation
1. Introduction to HTML DOM
DOM is 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
Reducing the number of DOM can accelerate the construction of DOM Tree and render tree during page parsing by the browser, thus improving the page performance. For this reason, we can save the HTML that is invisible to the first screen rendering in
Manipulating the DOM tree* * AppendChild method-Add child nodes to the end-Features: Similar to the effect of shear pasteBody> DivID= "Div1"> ulID= "Ulid11"> Li>TomLi> Li>MaryLi> Li>JackLi> ul>
Reducing the number of DOM can accelerate the construction of DOM Tree and render tree during page parsing by the browser, thus improving the page performance. For this reason, we can save the HTML that is invisible to the first screen rendering in
Abort method
Role
Abort method cancels an asynchronous download in progress
Basic syntax
Xmldocument.abort ();
Description
If this method is called when downloading asynchronously, all parsing actions are stopped, and the files in memory are freed.
Objective
The DOM (Document Object model), which is an API for HTML and XML documents (the application interface) The DOM depicts a hierarchical node tree that runs a developer to add, remove, and modify portions of a page. DOM was born of the
Recently, it was found that the DOMDocument object is very important, and XMLHTTP is also important to note that case sensitivity must not be mistaken.
Attribute:
Attribute list of the Attributes storage node (read-only)
List of child nodes of the
Double-click the input element to replace the div with a newly created input element. When the input loses focus, the content of the input is first transmitted to the original div, and the input is replaced with the div. The Code is as
For an interview with a summary written by yourself, refer to the article: "JavaScript Advanced Programming"1. Selector API*queryselector ()Queryselector () receives a CSS selector, returns the first element that matches the selector, and returns
Recently, it was found that all major libraries can use xxx. innerHTMLHTML fragments to generate node elements, and then insert them into each position of the target element. This is actually insertAdjacentHTML, but the nasty innerHTML of IE turns
The following example takes this HTML document structure as an example: Document Get a collection of child nodes: ChildNodes ()var ul = document.getElementById ("contents"); for (var i= 0; i Operation Result:li_1
First, we need to understand that Dom is a tree-based API for XML and has many implementations (each language has its own implementations ), we are discussing the implementation of DOM in Javascript or XHTML (HTML.
I. Use domConsider an HTML file:
Recently, I am working on OSG-related project R & D. In large scenarios, there will naturally be many nodes, and node operations will cause many problems. The purpose of this article is to help OSG developers save some time. Thank you for watching.
1. Create a node.
Createelement ():
VaR A = Document. createelement ("p ");
It creates an element node, so nodetype is equal to 1.
A. nodename will return P;
Note: The new element node created by the createelement () method will not be automatically
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.