1. Internal insertion of append () and Appendto ()Append: This operation is similar to the case when you perform native appendchild methods on the specified elements, adding them to the Document.AppendTo: in fact, using this method is reversed by
This article describes how to read from an XML file, operate the Dom, and output the Dom to a file to show how to operate DOM nodes through XPath in dom4j.
1. Read XML
Document originaltemplate1 = templateutil. getdocument
Thankfully, there are a number of ways to get nodes using JavaScript, and here's a quick summary (the following methods are passed in the IE7 and Firefox2.0.0.11 tests):
1. Get through top-level document node:
(1) document.getElementById (ElementID):
This example describes the method of jquery wrapping DOM nodes. Share to everyone for your reference. The specific analysis is as follows:
If you want to wrap a node with other tags, jquery provides the appropriate method, wrap (), which is useful
In JQuery, css functions can set effects for DOM nodes. CSS functions generally have the following usage: 1. determine whether an object is hidden: Symbol ("#id").css (& quot; display & quot;) & quot; none & quot; 2. Set the value of a
Query the DOM element value
/* * Browser example snippet: query DOM node value * * For a list of all SWT example snippets see * http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets */import org.eclipse.swt.
Core of DOM: NodeBecause 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, which are determined by the value of node. nodetype (1-12: JS
Code
Node. element_node (1)
How to obtain the elements to be updated is the first problem to be solved. It is gratifying to note that there are many methods to obtain nodes using JavaScript. Here we will give a brief summary (the following methods have passed the test in IE7
It is gratifying to note that there are many methods to obtain nodes using JavaScript. Here we will summarize the following methods (the test passes in IE7 and firefox2.0.0.11 ):
1. obtain from the top-level document node:
(1) document.
TIPS:
The concat and push methods of arrays.
The main differences between the two are:
Concat is a connected array and does not modify the original array. The returned value is the connected array. An important difference between concat and push is
1. NodeName: Name of the node1. The nodeName of the element node is the same as the label name2. The nodeName of the attribute node is the name of the property3. The nodeName of a text node is always #text4. The nodeName of the document node is
DefinedThe relationships in the nodes can be described by the traditional family relationship, which is equivalent to the document tree metaphor.Property"NodeType, NodeName, NodeValue"Each node has these three properties, and the node types differ,
When using JavaScript to create DOM nodes, document. createelement, setattribute,Document. createtextnode and Other lengthy node operation methods with browser compatibility issues, although some people propose to use String concatenation
OBJ. appendchild (newe)Add the child node to the end of the parent node.
OBJ: parent element reference of the node to be added; newe: new node to be added.
Note: I found that when adding a subnode, the parent node cannot be referenced. If the
Address: http://bluehua.org/2008/11/01/96.html
Run the following commands in two browsers:Code
Run code
Run code
Run code
The three sections of code are OK in Firefox, but only the third section can run normally in IE6. The first two
Html dom is a standard for getting, modifying, adding, or deleting HTML elements. In html dom, everything is a node. DOM is the HTML of the node tree.According to W3C html dom standards, all content in HTML documents is node:The entire document is a
DOM is a standard for getting, modifying, adding, or deleting HTML elements. The following describes how to operate html dom nodes. For more information, seeHtml dom is a standard for getting, modifying, adding, or deleting HTML elements. In html
TIPS:The concat and push methods of arrays.The main differences between the two are:Concat is a connected array and does not modify the original array. The returned value is the connected array. An important difference between concat and push is
Today we will talk about DOM attributes.We have already touched DOM attributes.For example:NodeName, nodeType ..... Today we will explain in detail.1. nodeName attribute: name of the node.If the node is an element node, the name of the element is
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.