HTML Review Essay JS (*^__^*)

Source: Internet
Author: User

---restore content starts---

 Map traversal 
Function B () {var week = new Map (); Week.set (" Mon "," Monday "); Week.set ("Tues", "Tuesday"), Week.set ("Wed", "Wednesday"), Week.set ("Thurs", "Thursday"), value = Week.get ("Thurs"); Console.log (( Week.get ("Thurs")); Week.delete ("Thurs");
Week.foreach (function (key,value) {
//(key, value, map object)//Consol E.log (value+ ":" +key+ "=" +map "); Console.log (value); });}

2016.6.8

via JS We can add attributes to an element such as
In the loop body
Xxx[i].index = i
We can add an index attribute to an element.

Josn{a:1,b:2,c: "Ten"}
json[' a '] =1;
array[1,2, "10"];
Array[0]=1;

The difference between JSON and array the subscript of an array is a number, and the JSON subscript is a string.
Array Splice (A, B) removes B elements from a position
splice (A, A, "C", "B") from a delete b insert "C" "B"
concat linked array
A.concat (b) array A after connection B
a=[ 1,2,3,4]
A.join ('--p ') an element between a--p connection

Array a.sort () string ordering
Array numeric sorting
A.sort (function (n1,n2) {
return n1-n2;
Compare functions as Parameters


})


Time Date Timer
SetInterval (show,1000) has continued to execute
SetTimeout (show,1000) executes once

BUT1 Start Timer

But2 off Timer

The timer has a second delay, so we can call the timer directly under the timer to eliminate the delay of one second.

Childernodes text nodes that are above and beyond ie6-8

NodeType 3 = "Text Node 1 =" Element node

But children does not contain text nodes

And the child node is only the first layer, not the inner layer

OffsetParent
CSS review: Absolutely positioned elements are positioned according to the parent position of the relative location
Offsetparent is the parent element that gets the element that determines positioning

Get elements by class

Dom Action add Element
1. First add an element with createelement, but it will not appear on the page at this time.
2. We add the parent element under the parent element by calling AppendChild (child node).
e.g

Insert element:

AppendChild is inserted into the end.

InsertBefore is inserted before.

Parent. AppendChild (child node)

Parent. InsertBefore (sub-node, a[0])

To avoid the absence of elements, make a judgment.

Understanding Document fragmentation (basic not how to use it):

1. Create text fragment Ofrag = Document.createdocumentfragment ();

2. Circulate to the fragment inside the Canadian Ofrag.appendchild (oLi);

3. Adding Fragments Oul.appendchild (Ofrag) to Oul;

AppendChild () 1. Delete the element from the parent before adding the new parent

Dom Operation:

Search (TXT) Fuzzy Lookup matches to the location where the first match was returned, not matched to return-1

Ignoring case will tolowercase two strings ();

Table Get elements:

Tbodies tHead tFoot rows cells

Ali here is not an array just a collection of elements and sort is just an array of methods

We can create an array to put the elements in the Ali into an array








  

---restore content ends---

HTML Review Essay JS (*^__^*)

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.