1. Render functionSo came directly to render, would have wanted to skip, found that the back of the route seems to have a little connection with it. Let's take a look at render1.1 Official website at the beginning of a very ignorant, do not know
Performance Comparison Between createElement and innerHtml: createelement
In js, there are roughly two ways to add html dynamically. One is to create a document. createElement method, and then add it using Element. appendChild or Element. innerHTML =
During the development process, you need to use js to dynamically add radio to the page, and use the document. createelement () method to implement it.CodeAs follows:
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http:
// Create a label by defining the Method//*************************************//Copy codeThe Code is as follows:Var createLabel = function (id, name, value ){Var label_var = document. createElement ("label ");Var label_id = document.
//*************************************//
// Create a label by defining the Method
//*************************************//
VaR createlabel = function (ID, name, value ){
VaR label_var = Document. createelement ("label ");
VaR
Recently encountered a problem in the project, there is a asp.net web program can only run in IE7, now xp are eliminated, everyone uses IE8-IE11, so this web app also needs to upgrade to adapt to all IE versions. According to the incompatibility of
When we need to dynamically generate DOM objects, we will use the createElement method to create them. However, in IE and Firefox, The createElement method is different.
In IE, you can use either of the following methods to create an element:
1.
As a js-DOM developer, you must know some DOM methods: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
Recently encountered a problem in the project, there is a asp.net web program can only run in IE7, now xp are eliminated, everyone uses IE8-IE11, so this web app also needs to upgrade to adapt to all IE versions. According to the incompatibility of
Getelementbyid getelementsbyname getelementsbytagname
Getelementbyid obtains the node through the ID attribute of the node. This object contains attributes such as nodename, nodetype, parentnode, and childnodes.
Nodename indicates the node name. If
Most of the information that can be found on the Internet is that createDocumentFragment is used mainly because it avoids the efficiency problem caused by multiple times of adding createElement to document. body. For example:
Copy codeThe Code is as
This article uses examples to briefly introduce the createElement event in javascript. For more information, see createElement. It is the concept of using W3C DOM to create a subnode, that is, a subelement, in HTML.
The Code is as
Today, I handled the compatibility problem of ie and ff for a date selector. It was difficult to find an error in this case. After a long time, I found the error and found the method document for creating elements in js. createElement (). This
The original js Code is:Var theform = document. forms [0];Theform. appendChild (document. createElement (" "));This is useful in IE, but Firefox does not.Take document. createElement ("") and test it. It is found that there is an error in this
My blog has moved to my site.
Site Link
RSS
When dealing with cascading menus in the previous article, I found an interesting phenomenon, using createelement/innerhtml/document. the write performance is different. I tested it myself.1.
Today, when we learned about DOM node operations, we discovered an interesting phenomenon of the createelement () method for creating DOM nodes.The code is as follows:var Box=document.getelementbyid ("box");//Assume that there is already an element
Most of the internet can be found that the use of createdocumentfragment mainly because of avoiding createelement multiple times added to the document.body caused by efficiency problems, such as:
Copy Code code as follows:
var
Talking about the createElement event in javascript, javascriptelement
CreateElement is the concept of applying W3C DOM to the image model in HTML to create a subnode, that is, a subelement.
Copy codeThe Code is as follows:
Note: value is actually a
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.