1: Modify the execution method of the loop
For (VAR I = 0; I RunCode }In this way, the value of element. childnodes. length must be setVaR n = element. childnodes. LengthFor (VAR I = 0; I Execute Code}
2: Number of Dom modification operationsDom
Fortunately, everything is available on the Internet. I found a function with the Best Browser compatibility. It is tested to be compatible with IE, Firefox, and chrome and will not cause any scroll bar error. I will archive it for later use.
Local object
① Array class
② Date class
Object Type built-in object① Global Object② Math object
Host ObjectContinue to learn about objects in JS today, global objects and math objects built in yesterday, and continue today.
Host ObjectAll non-
Local object
① Array class
② Date class
Object Type built-in object
① Global Object
② Math object
Host Object
Today, I continue to learn about objects in JS. Yesterday I learned about two important objects, array and date, in the local object. Today,
If you do not know the reason, do not worry too much. Please study CSS rules and view this article
Article : Use CSS to fix everything: 20 + Common Errors and fixes.
If these are invalid, you can fix them using the 12 JavaScript solutions listed
In the past, these things were clearly understood, but they could not be explained, nor did they go into depth. Today, when I read "enlightened JavaScript", I saw the author's description, and the "toilet" was opened.
The excerpt is as follows.
Well, let's build it step by step. First, let's take a look at the original method of inheritance:
CopyCode The Code is as follows:
We can see that in fact, the root of inheritance lies in this step programmer. Prototype = new person (). That is
Document Object
The following table lists some common attributes of the Document Object of BOM:
Genus
Description
Alinkcolor
The color of the activated link, as defined by *
Bgcolor
The background
First, we will briefly introduce some methods for attributes:
Attribute enumeration:
For/in loops are used to traverse object attributes. For example
CopyCode The Code is as follows: var OBJ = {
Name: 'obj1 ',
Age: 20,
Height: '20180101'
}
VaR STR =
When adding special effects to a webpage, you often need to add the "onLoad" event to the , that is, execute an event after the webpage is loaded. For example: Article When the CMS is used.
At this time, we will think of using "window. onload
Call and apply methods
The call method can change the context this pointer. Similar methods include apply, which is mainly used when the methods of JS objects call each other to keep the current pointer of this instance consistent, or in special
Hasownproperty Method
Returns a Boolean value indicating whether an object has a property of the specified name.
Object. hasownproperty (proname)
Compatible with winie5.5 +, Macie-, nn6 +, Moz +, and Safari-
ParametersObject
Required. An
Window object
The window object indicates the entire browser window. The window can also be used to move or adjust the size of the browser it represents.
I. window operations Window. moveBy (dx, Dy)
Move the browser window horizontally to DX
For example, debugging in Chrome is as follows:
Program , Clearly shows this:
However, it is not that simple. Let's look at the followingCode:
Obviously, the constructor of obj is no longer a function for creating it. the name is also
-Enter a keyword and click the search engine link to go to the search engine page.
-If you enter a keyword and press enter, the default search engine is used. The default search engine is changed for each selected search engine.
-Automatically
The objects in Javascript have not yet explained what is going on. When it comes up, we will go straight to the topic, class/Inheritance/prototype/private variable ....
As a result, after reading it for a long time, I had a rough understanding and
LookCode
No title page
DOcument. getelementbyid ("adiv"). innerhtml = TXT. Join ("");
Using innerhtml is converted to HTML. Bold display
Innertext is not translated, and all labels are displayed.
The "OK" function in JS is like
First, let's continue with the above
Code To extend this Code:
Copy code The Code is as follows:
The result is false. That is to say, the methods of these two objects are different. We know that in C #, each object maintains a method table, but
Dom basics-create a table
Using js to dynamically create a table can be in two formats: appendChild (), insertRow, and insertCell (). However, the first type may have problems with IE, so the second type is recommended.
1. insertRow (index): index
For example, the control is rendered as the anchor control, and the DropDownList control to be discussed here is also rendered as a normal select control, the following asp.net page defines a web server control DropDownList and a common select
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service