JavaScript——六

 The difference magin and padding: https: //www.cnblogs.com/zxnn/p/8186225.html

Between brothers: magin

padding: parent-child relationship

and left and right body frame web distance magin 8 (fixed)

The following is the basic code for experiments :()

Experiment with style:

 

 

 

 

  script:

 This amplification effect provided there is a big picture and a small picture, not our operations to make it larger, it is already a big blanket!

Also note that we use onmouseover and onmouseout time will trigger bubble, the operation will be executed at this time that the picture is displayed several times, then we can use onmouseenter and onmouseleave instead, these two methods will not trigger this bubble reaction

 

Analog scroll bar:

Red is we write, gray is that we use overflow: auto with their own system of

 

 

Animation encapsulated into a function which can later use

 

If you click on a button multiple times will speed up the moving speed (per point once they create a timer), in order to avoid

 

 

In this case you can create animated user to multiple boxes

 If time animation in a box you want to know his place, then you have to set a timer from time to time to see

Callback function to use, so that the two boxes were arriving in the destination, from one to another began to go

 

 

10 two output

Function is only called back

 

10 undefine

Pre-analytical variables: first declaration in advance, but the assignment the same position, then the order to execute code

The method of this, is to call the object object

 If the method to a function, use the "function name ()" at this time, this represents the window

But the constructor constructor of this attribute is not an object

But if sayHi this function to write out that their address is the same, until then compare their values ​​is true

Advantages: save memory

Disadvantages: possible naming conflicts

 

 prototype: prototype object constructor

By using prototype to add something to the constructor, then this thing in memory address only one, although you create multiple objects

When members find someone to access an object's member objects, if not then look for an object prototype member

Between them by _proto _----> prototype connected

Examples of members: can be accessed through the object, as defined in the above sayHi constructor is an instance member

Relationship included solid lines represent

 Prototype chain:

Prototype object ----> prototype object ----> prototype object: the prototype chain

When a property call the object, we find that order, find a stop, followed by the chain looking for can not be found

Prototype chain from bottom to top:

But like this, then there will be bug, this time attributes construct and not the same as before, pointing to the error occurred, and you write the original function inside will not, he had the equivalent of you reset

Resolve the error; the value of this set point to construct constructor

 The constructor provided by the system:

Some functions are defined in an object provided inside the prototype object, which can be shared

Can not write, so the system he had a limit, you write is useless, because the system for many functions provided by him, if you re-assignment to clear things inside certainly not

 

Guess you like

Origin www.cnblogs.com/kongbursi-2292702937/p/10786485.html