NodeListThe NodeList instance object is a class array object whose members are node objects, including the ChildNodes and Queryselectorall () method return valuesA dynamic collection is a change in the DOM structure that can be automatically reflected in the saved objectStaticNote NodeList are not all dynamic collections, where the Queryselectorall () return value is a static collection nodestaticlistArrayS
nodelist
Each node has a ChildNodes property that holds the NodeList object. NodeList is a class array object that holds an ordered set of nodes that can be accessed by location. The uniqueness of the NodeList object is that it is actually the result of dynamically executing the query based on the DOM structure, so ch
function Getdatatype (any){/* (1) Object.prototype.toString.call method judgment type:Pros: Generic, returns the type of "[Object String]" specific objectDisadvantage: Cannot return an inherited type (2) typeof XDisadvantage: The object type can not be subdivided;Advantages: The application of the judgment of NULL null ' undefined ';The return type has: ' Undefined ' "string" ' Number ' ' Boolean ' function ' ' object ' (3) instanceof can return the specific type, only for the object created wit
Convert the HTMLCollectionNodeList pseudo array to an array. For more information, see. Here, objects that meet the following conditions are called pseudo arrays.
1, with the length attribute
2. Data Storage by index
3. methods such as push and pop with no Array
For example
1. arguments in the function.
2. Use document. forms, Form. elements, Select. options, document. getElementsByName (), document. collection (HTMLCollection, NodeList) obtained by
Here, objects that meet the following conditions are called pseudo arrays.1, with the length attribute2. Data Storage by index3. methods such as push and pop with no ArrayFor example1. arguments in the function.2. Use document. forms, Form. elements, Select. options, document. getElementsByName (), document. collection (HTMLCollection, NodeList) obtained by getElementsByTagName () and childNodes/children.3. Special writing objects, suchCopy codeThe Co
Here the objects that meet the following criteria are called pseudo arrays
1, with Length property
2, storing data by index
3, Push,pop and other methods that do not have an array
Such as
1,function within the arguments.
2, through Document.forms,form.elements,select.options,document.getelementsbyname (), document.getElementsByTagName (), A collection (htmlcollection,nodelist), such as Childnodes/children, obtained in other ways.
3, the object of spe
Here the objects that meet the following criteria are called pseudo arrays
1, with Length property
2, storing data by index
3, Push,pop and other methods that do not have an array
Such as
1,function within the arguments.
2, through Document.forms,form.elements,select.options,document.getelementsbyname (), document.getElementsByTagName (), A collection (htmlcollection,nodelist), such as Childnodes/children, obtained in other ways.
3, the object of spec
In JS, through document.getElementsByTagName ("tag"), get a NodeList object, for this NodeList object we can use subscript way to access, It is easy to use the NodeList object as an array or in an array to be used as an NodeList object, and then call the NodeList method, whi
As a result, they always keep the latest and most accurate information. Essentially, all NodeList objects are queries that run in real time when accessing DOM documents. For example, the following code can cause an infinite loop:
Copy Code code as follows:
First get all the div on the page, because this set (Divobj) is "dynamic", so whenever a new div is inserted into the page, Divobj adds the newly added Div. In other words,
Remember last year's work encountered old IE and modern browser JS about DOM operation compatibility issues, in Chrome, IE, Firefox test getelementsbytagname return value, the problem arises, Both Chrome and opera return the NodeList object, while IE and Firefox return the Htmlcollection object. At that time to check the information, a lot of articles said IE and Firefox did not follow the specifications, but the previous days I accidentally encounter
Example of four methods for implementing the circular Nodelist Dom list in native JS: nodelistdom
This article describes four methods for implementing the circular Nodelist Dom list in native JS. We will share this with you for your reference. The details are as follows:
Function $ (id) {return document. getElementById (id);} var _ PAGE = {timeListDom: $ ('timelist')}; var spanDoms = _ PAGE. timeListDom.
When importing other people's source code, encountered a problem:
Show Nodelist.item (0). Gettextcontent () requires a cast, but the cast is prompted after casting:
This is done online because there are two classes with the same package name
Htmlcollection Interface Definition
Interface Htmlcollection
{
ReadOnly attribute unsigned long length;
Node item (in unsigned long index);
Node Nameditem (in Domstring name);
}
What must be said for the Htmlcollection
Java tutorial translation Sequence Java Introduction Build a JSE development environment-install JDK and eclipse Language basics Java Hello World Program Analysis Variable Java Variables Java Native type Conversion of Java
Dom Parsing
In the DOM interface specification, there are four basic interfaces: Document, node, nodelist, and namednodemap. Among the four basic interfaces, the document interface is the entry for document operations, which is inherited from the node interface. The node interface is the parent class of most other interfaces. interfaces such as document, element, attribute, text, and comment are inherited from the node interface. The
Java-based automatic numbering system (similar to automatic numbering in word)
Functional requirements:
1. Obtain the next number based on the number of chapters and the current title to meet the requirements of different levels of numbers, just like the automatic numbering function in word.
2. You can call the generation method directly in freemarker to obtain the correct number.
Objective: To obtain the number of the current chapter by calling a met
){StringWriter. close ();}InputStream = new ByteArrayInputStream (sb. toString (). getBytes ("UTF-8 "));} Catch (Exception e ){Logger. error ("", e );Try {If (stringWriter! = Null)StringWriter. close ();If (inputStream! = Null)InputStream. close ();} Catch (IOException e1 ){Logger. error ("", e );}}Return inputStream;}The preceding section describes how to read the hard drive xml file into the memory and write it to the hard drive. Inputstream is used to read or set xml nodes and node attribute
, if you are looking for a namespace that is the default, all elements of element name computer can be implemented as follows:
Copy Code code as follows:
Xpathfactory xpathfactory = Xpathfactory.newinstance ();
XPath XPath = Xpathfactory.newxpath ();
Xpath.setnamespacecontext (New Customnamespacecontext ());
XPathExpression compile = Xpath.compile ("//df:computer");
NodeList list = (nodelis
Java converts the DataTable data type to a tree structure (Multi-tree)
Problem analysis: a relational database table ,:
The following four fields are displayed: Country, Province, City, and Street, which have a logical subordinate structure. Now we need to construct this data into a tree structure ,:
VcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20150602/20150602084314297.png" alt = "\">
It is not converted from the origi
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.