First, event 1-26
1, onmousedown
Definition: The OnMouseDown event occurs when the mouse button is pressed
2, OnMouseUp
Definition: The OnMouseUp event occurs when the mouse button is released
3, OnMouseMove
Definition: The OnMouseMove event occurs when the mouse pointer moves
JS object supporting the event: Document
But OnMouseMove does not have an event for any object by default;
Because mouse movements occur frequently.
4, onmouseover
Definition: The onmouseover event occurs when the mouse pointer moves over the specified object
5, onmouseout
Definition: The onmouseout event occurs when the mouse pointer moves out of the specified object
6. OnClick Click event
Definition: The onclick event differs from the onmousedown. The Click event occurred on the same element
Mouse down time occurs after the mouse release time occurs.
Understanding: Events only occur when the mouse is pressed to lift.
7. onfocus Cursor Move in Event
Definition: The onfocus event occurs when an object receives focus
8. onblur Cursor Move out event
Definition: The onblur event occurs when an object loses focus
9. OnContextMenu Right-click event
Occurs when the right mouse button is pressed
10, OnSubmit
OnSubmit event will be in the form of the Confirmation button (Submit) is
Click Yes to happen.
11, onkeydown
The onkeydown event occurs when the user presses a keyboard key
12, onkeyup
The Obkeyup event occurs when the keyboard key is released
13. onload
The OnLoad event occurs immediately after the page or image has finished loading
14, Onscroll
Onscroll event occurs when you drag the scroll bar
15, OnResize
OnResize event occurs when a window or frame is resized
16, OnMouseWheel
OnMouseWheel event occurs when the mouse wheel scrolls under IE, chrome
17, Dommousescroll
The Dommousescroll event is a standard down (FF) mouse wheel event,
Occurs when the mouse wheel scrolls
18, onReadyStateChange
onReadyStateChange event: When a request is sent to the server;
We need to perform some response-based tasks. Whenever readystate
Changes, the onReadyStateChange event is triggered.
The readystate attribute holds state information for XMLHttpRequest.
In the onReadyStateChange event, we specify that when the server responds
The tasks that are performed when you are ready to be processed.
19. Attachevent Binding Event
The binding event under IE, 2 parameters, the first what event, the second one
The line function (in reverse execution). Note this points to
such as: obj. Attachevent (' onclick ', AAA)
function aaa () {}
20. AddEventListener Binding Event
The binding event under standard, 3 parameters. 1 What events (not added),
2 Execute function 3, a Boolean value. True is the capture phase, false is
Bubbling stage
21. Event object refers to the status of events
Simple: something that has the details of the event stored
More professional on the Web: event objects represent the state of events, such as the elements in which events occur
The state of the keyboard key, the position of the mouse, the state of the mouse button, usually
Used in conjunction with the function.
22, ClientX, ClientY
Get the mouse position under the event object
23, Cancelbubble =true
To cancel a bubbling event under the event object
24, KeyCode
Under the event object, get the key that the user pressed the keyboard
25, Preventdefault ()
To block the binding of default default events
26, return False
Common notation to block default time
Second, DOM 27-46
27, getElementById
Get an element from an ID
28, getElementsByTagName
Get a set of elements from a tag name
29, ChildNodes
Gets a child node, but a blank node is obtained under the standard
Gets the node of the first level child element
30, NodeType
Node type
1) Element node (label) 2) Text node (blank node)
31, children
Get child nodes, but no compatibility issues
Gets the node of the first level child element
32, Firstelementchild | | FirstChild
Under standard: Firstelementchild IE does not support
Under IE is FirstChild
Gets the first of the child elements
33, Lastelementchild | | LastChild
Under standard: Lastelementchild IE does not support
Under IE is LastChild
Get the last one in the child element
34, Nextelementsibling | | NextSibling
Under standard: nextelementsibling IE does not support
IE under nextSibling
Gets the next sibling node of the child-specified element
35, Previouselementsibling | | PreviousSibling
Under standard: previouselementsibling IE does not support
Id:previoussibling
Gets the previous sibling node of the specified element
36, ParentNode
Get parent Node
37, OffsetParent
The parent node is the body if the parent node is not located.
38, offsetwidth-----have problems
Gets the actual width of the element (Width+padding+border)
39, Offsetheight
Gets the height of the element (Height+padding+border)
40, ClientWidth
Gets the inner width of the element (width+padding)
41, ClientHeight
Gets the inner height of the element (height+padding)
42, createelement (sign)
Create a Node
43, AppendChild (node)
Append a node
44, InsertBefore (node, original node)
Insert before an existing element
45, RemoveChild (node)
Delete a node
46, ReplaceChild (node, existing node)
Replace existing node
Third, BOM operation: 47-53
47, window. Open ()
Open window
48, window. Close ()
Close window, not supported under standard
49, window. Location
Get browser address
50, window. Location Href
Get the overall URL
51, window. Location Search
Get a question mark? The following content, including the question mark
52, window. Location Hash
Get siren # Behind the contents, including siren
53, window. Location Reload ()
Auto Refresh, Timer mate
53, window. Navigator UserAgent
Get browser information
Four, JS basic: 54-126
54, if else if .... Otherwise...
55. Switch IF
56,? : Miki, that is, if ... Otherwise...
57. For () {} for loop
58. For in
59, While=for
60. Continue terminates this cycle
if (i=2) continue skip this condition
61. Break terminates the current cycle
if (i=3) break ends this time
62, undefined not defined
63, null=========?
64, = = = Only comparison, no conversion type
65, = = Not only compares, but also converts two things into the same type
66. = Assign Value
67,! That's not the point.
68, SetTimeout
Set timer, 2 seconds, execute once, and execute only once,---time bomb
69, Cleartimerout
Clear the timer, clean the Settimerout
70, SetInterval
Set the timer to execute once every two seconds
71, Clearinterval
Clear the timer, clean the SetInterval
72, arguments
An element collection of arguments
73. Call
Change this orientation
fn name. Call (this, ' black ') The first argument is the environment of the function's row,
Starting with the second argument is the true argument of the function
Odiv.onclick = function () {
Tochange.call (This, ' black ');
};
function Tochange (scolor) {
This.style.background = Scolor;
}
74. Apply
Change this orientation,
Function Show (A, B)
{
Alert (' This is: ' +this+ ' \na is: ' +a+ ' \nb is: ' +b ');
}
Show (12, 8);
Show.apply (document, [12, 8]);
The second parameter is in the array situation
75, callee ===============? Call the function itself.
76, Var arr= ""; declares an array
77. Var arr=new array () declares an
78. Push
Adds one or more elements to the end of the array and returns the new length
79. Pop
Delete the last element of the array and return this element
80, Shift
Deletes the first element of the array and returns the element
81, Unshift
Adds one or more elements to the beginning of the array and returns the new length
82, Splice
Delete the element and add a new element to the array
83. Join ()
Put all the elements of the array into a string. Element by specifying
Separators are delimited by the
84. Sort ()
Sorting elements of an array
85, Concent----concat ()?
Concatenate two arrays or multiple arrays and return the result
86. Split
Split string, get array
87, substring
Get string
including start excluding end
88, IndexOf
Retrieving strings from the previous
89, CharAt
Get a character
90, var re=//; declares a regular object
91. var re=new RegExp () declares a regular object
92, search Find a string, only find the first occurrence of the location
93, Month ===============?
match-matches the regular thing, pick something back to the array
94. Test uses a regular test to verify that the string conforms to the rules it rules
95. Replace replaces, replace the rules with a string
96, quantifier: {n,m} appears at least n times, up to M times
+ Many
* {0,} 0 to any time
? 0 or one time {0,1}
{N,} at least n times, Maximum unlimited
{, m} at least not limited to M-Times
{n} exactly n times
97. Character class:
1[abc]2 1 and 2 appear in the middle of a or B or C
[^0-9] Excluding numbers all can be
[A-z] all English
[0-9] All the numbers
98. ID: I ignore case g global match
99, the end: ^ $
100. Escape:
\d finding numbers [0-9]
\d except numbers [^0-9]
\s Blank
\b Word boundaries
\w Digital Letter Underline-user name
. Any character
\. Represents. itself
101. Var odate= new Date () Gets the current time
102, GetHours () Get hours
103, getminutes () Get minutes
104, Getseconds () Get seconds
105, getFullYear () get the year
106, GetDay () get the week
107. GetDate () Gets the current time and date
108, SetDate () set a day for one months
109. Var oimg=new image () creates an Image object
110, what is called Ajax
Non-flush operation via XMLHttpRequest and server communication
Ajax takes an asynchronous request
111. The difference between synchronous and asynchronous
Synchronization is the same time to do one thing
Asynchronous is the same time to do more things
112. How Ajax interacts
1) Send data and return () (registration)
2) only send not return () ========? Example
3) do not send only return (stock)
113. The difference between post and get
1) Send a different way: Get load URL say hello back
Post puts the data in a transmission.
2) safety is not the same
Post is relatively secure, get is unsafe
3) URL length is not the same
ie the get URL is truncated beyond 2048 bytes
Post has no upper limit
4) Caching issues
Get can cache URLs, post does not cache URLs
5) different use
Get: Querying data, post modifying data
114. What is the data sent?
Concatenated data: key1=value1&key2=value2
115. What is the return data?
Returns a string
116, cross-domain: Jsonp?
(cross-domain with script tags)
Create a script tag on the head,
Change the script tag in SRC
117, Ajax writing steps?
1) Create an Ajax object (to have a mobile phone)
2) linked server open (dial-up)
3) Monitor data return onreadystatechange (Listen)
4) Sending data send (say)
5) Close (ignore) (Hang up)
118, how to take the JSON? =========?
by concatenating data
119. What is an object?
object is a whole and provides some operations externally. |
The black box, not seeing the inside look,
A button that can see the surface
120. What is object-oriented?
When working with objects, focus only on the functionality provided by the object,
Don't pay attention to its internal details, such as jquery | |
When using a thing, do not go inside the tube is
What to do, just use the function of it
121. What does the reference type mean? =========?
122, the essence of this is actually this method or function
This is who the object belongs to. The function is preceded by a new
This will expire when the
123. What is a prototype? =========?
The archetype is to add things to a class of objects
124, object-oriented how to write? =========?
125. What is the method of inheritance?
Inherit in the form of a prototype chain
126, object-oriented features?
Encapsulation, inheritance, polymorphism
v. Common techniques:
1, plus switch: bbtn
For example:
<script>
window.onload = function () {
var aLi = document.getElementsByTagName (' Li ');
var aimg = document.getelementsbytagname (' img ');
for (var i=0;i<ali.length;i++) {
Ali[i].bbtn = true;//------Set switch
Ali[i].index = i;
Ali[i].onclick = function () {
if (this.bbtn) {
Aimg[this.index].src = ' on ' + This.index + '. png ';
This.bbtn = false;
}
else{
aimg[this.index].src = ' off ' + This.index + '. png ';
THIS.BBTN = true;
}
};
}
};
</script>
2: Index;
For example:
<script>
Window.onload=function ()
{
var Obtn=document.getelementbyid (' btn ');
var abtn=obtn.getelementsbytagname (' input ');
var Otext=document.getelementbyid (' text ');
var adiv=otext.getelementsbytagname (' div ');
for (var i=0; i<abtn.length; i++)
{
abtn[i].index=i;//Add index values First
ABTN[I].ONCLICK=FN1;
}
function fn1 ()
{
alert (this.index);//after getting index value
adiv[this.index].style.background= ' Yellow ';
}
};
</script>
3, recursive ===============?
4. Enumerate ================?
5. Timer:
SetInterval ()
JS important points of knowledge