JS Section Summary

Source: Internet
Author: User

1 Currentstyle can get the inline style, but incompatible with other browsers with getComputedStyle (div,null) This IE low-level version is incompatible;
if (Div.currentstyle) {
}
else{}
Composite style (background) with single style (width)
Currentstyle cannot take compound styles

2 extract Link's href:olink[' href ']=this.id+ ". css";

3 The length of the array can be written
. Shift () Remove from the head. Unshift (). push ()
. Splice (start, number) remove from middle
Sort () array sorting string
Sort () to arrange numbers.
Arr.sort () {
function (N1,N2) {
Return N1-N2
}
}


4getElementsByTagName ("label") [0] only add [0] to make
5.removeAttribute ("") Delete a property for click Reset Properties

6charAt instead of square brackets to extract characters under IE6 compatibility

7offsetleft\offsetwidth

Dom

9 children is just an element without bugs, instead of Childnodes[i].nodetype

10parentNode parent Node
OffsetParent parent node with positioning
11creatElements

AppendChild () First delete the element from the original parent
Add to new Parent
JSON array
JSON={A:12,B:5,C: "ABC"}
json.b++
B=6

Json{"A"}
ARR[0]

Offsetwidth has a bug with any border element and uses GetStyle () to get the element attributes


15prototype CSS-like class, Add Method Array.prototype.fangfa=function () {} to a group of objects

Adding attributes with constructors
Using a prototype plus method

16 object-oriented simple with JSON,
Not suitable for multiple objects

There's only one in the whole program, it's easier to write.

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.