CSS; HTML; JAVASCRIPT face questions

Face questions Area:

1.

apply () and call () of the difference?

A: The role call () and apply () is the only major change of this point; their difference is transmitted to function parameters

Call () : argument using its own list as a parameter;

Apply () : turn requires an array of parameters;

 

2.

Interpret CSS  the sprite was dropped , how to use ---- (Sprite map)

Definition: It allows you to a page related to all sporadic images contain a large map to go, so that, when accessing the page, the picture will not be loaded as a piece of land slowly as before shows up (the picture is a way of web processing applications)

How to use : Some background image to a web page integrated into a picture file, and then use the CSS "background-image", "background- repeat", "background-position" a combination of background positioning, background-position can be digital locate the precise position of the background image.

Pros and cons : Pros --- (1) reduce the image bytes.

         (2). Home burned pages of the HTTP request, which greatly improves the performance of the page

        (3) Reduce the difficult problem of naming

        (4) Maintenance is more convenient

    Shortcoming --- (1): When the picture merge, you should merge multiple images into a reasonable and orderly picture, but also good enough to leave space to prevent unnecessary background plate

       (2): Maintaining too much trouble, if the page background there is a little change, you change the general picture of this merger

 

3.

The difference between the standard browser model and vertebral weird box?

First, two modes can be produced using a standard box-sizing properties:

Standard mode: box-sizing: content-box;

Weird box: box-sizing: border-box;

The difference between the two modes:

padding the standard mode is set distraction, and bizarre box is equivalent to fixed size of the box, and then is loaded in the cassette. Size of the box will not be softened padding.

Standard mode: box total width / height = SUMMARY Width / Height + padding + border + margin. effect:

 Weird case: the total width of the box: width / height + margin. In quirks mode effect:

 

4.

Event delegates:

Today there are one billion ul li, li trigger event requires click to bring up the corresponding content li

var ul=document.getelementByTagName("ul")[0];

ul.onclick=function(event){

    event=window || target.event;

   var target=event.target || event.srcElement;

   console.log(target.innerHTML);

}

 

5.

4 ways to create objects:

(1): literal way to create an object;

(2): Creates a new method;

(3): to create the object using the constructor manner;

(4): Create a prototype-based object methods;

 

6.

API (1) of the array may have to change the original array:

pop();

push();

reverse();

shift();

sort();

splice();

unshift();

API (2) of the array may be varied in the original array are:

concat();

join();

slice();

 

Three methods are loaded asynchronously 7.js

(1):defer

(2):async

(3):function aasyncScript(url,callback){

var script=document.createElement("script");

  if(script.readystate){

    script.onreadystatechange=function(){

      if(script.readystate=="complete" && script.readystate=="loaded"){

    callback()

}

}

}else

script.onload=function(){

callback();

}

}

script.src="test.js";

document.head.appendChild(script)

}

asyncScript("test.js",function(){

    test();

})

 

 

Guess you like

Origin www.cnblogs.com/lyx1014/p/11176281.html