Summary of 23 JavaScript Study Notes

Source: Internet
Author: User
Tags javascript array

1. javascript prototype: prototype requires a constructor to define object members when implementing object-oriented (such as defining a class, methods are attached to the prototype of the constructor.

2. In javascript, prototype of the subclass constructor must be set as an object instance of the parent class to implement inheritance.

3. Block Model of css:
The outermost margin is used to set the distance from the edge of the space occupied by an element to the adjacent element.
Border: border is used to set the line of an element.
Padding is used to set the distance between the borders of each element.
In addition, the background attribute is the content and padding areas, that is, the content and gap.
The width and height in the attribute in css indicate the width and height of the content area. This is IE, and the above edge box must be added to firefox.

4, System. Drawing. Imaging. BitmapData... lock a bitmap to the memory ..
Two functions are available to lock image data to the memory.
One is: Bitmap. LockBits (Rectangle rect, ImageMode flags, PixelFormat format)
Another one is Bitmap. LockBits (Rectangle rect, ImageMode flags, PixelFormat format, BimapBitData bitmapData)
BitmapData has an important attribute Scan0, which is a pointer pointing to the first location in the memory of the image data. use memory tracking and enter the Scan0 value in the address to view the memory allocation.
We can use System. Runtime. InteropServices. Marshal. WriteByte (IntPtr, byte val) to change the pixel value at the specified position.
The IntPtr type is called "platform-specific Integer type". It is used for local resources, such as window handle statements.

5. Reflection: reflection is a process of running database type discovery. reflection can be used to obtain a list of all types contained in a given Assembly. This list includes methods, fields, attributes, and events defined in a given type. you can also dynamically find a group of interfaces supported by a given class, method parameters and other related information, such as the base class, namespace, and data list.

For/in statements in javascript:
For (variable in obj)
Statement;
One of the most useful functions is that it can enumerate all the enumerated attributes of an object, including native attributes and inheritance attributes. This provides a powerful reflection mechanism for javascript.
For example:
-- For (var each in document. body)
-- Document. write (each + ":" + document. body [each] + <br/> );
-- // Enumerate and print all attributes of the body
Variable can be any expression ..
For example:
-- Function keys (obj ){
-- Var ret = new Array ();
-- Var I = 0;
-- For (ret [I ++] in obj)
-- Return ret;
--}
The preceding functions return the attributes of an object as an array.

6. The distance between the content in the cellpadding cell of the html-table Control and the cell
The cellspacing attribute indicates the distance between cells.
Align is horizontally aligned with left right center (indicating the horizontal alignment of elements in a cell)
Vlign is vertically aligned with top bottom middle

7. Base64: According to RFC2045, Base64 is defined as Base64 content Transfer Encoding. It is designed to describe the 8-bit bytes of any sequence as a form that is not easily recognized by people. (The Base64 Content-Transfer-Encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable .)

8, margin: the upper and lower margins of 0 PX auto are adjusted automatically around 0 PX.

9. Differences Between opener and self in js: opener references <objects that open the current window>. If the current window is opened by users, the value of opener is null.
The self-reference attribute is an application of the current window object, which is synonymous with the window attribute.
(Self indicates the window itself, and opener indicates the window that opens itself. For example, window A opens window B. if you rely on window. for window B, self represents window B, while opener represents window .)

10, wnd. location. search. slice (1); // get "? "The following string, wnd is a reference to a window object.

11.g In the expression
G/global indicates global search
I/ignore indicates case-insensitive
Gi and above combinations

12. forward and reverse pre-check
(? = Pattern )(?! Pattern) is not obtained, only to check whether the subsequent string appears as expected

13. setcapture: setCapture captures mouse events to the specified objects in the current document. This object receives all mouse events for the current application or the entire system. SetCapture captures the following mouse events: onmousedown, onmouseup, onmousemove, onclick, ondblclick, onmouseover, and onmouseout.

14. Using in delete in javascript and using an object as a set can easily implement a set (delete operator deletes the specified object attribute, array element, or variable. returns true if the deletion is successful. returns true if the number of operations does not exist)
For example:
--- Var aSet = new Object ();
--- SSet ["key"] = true; // Insert a new element (whether or not it already exists)
--- If ("key1" in aSet)
--- Delete aSet ["key1"] // delete if key1 exists
--- If (delete aSet ["key2"])
--- ASet ["key2"] = true; // Delete the original element and update key2.

15. The-0 and | 0 operations in js can implicitly convert a character into a number, and the latter will integer a number.

16, []: Binary operators used to access objects and array elements.

When the second operation of [] is an object, call its toString () method for conversion. If the conversion fails, call the valueOf () method for conversion.

17. javascript exceptions always spread up the call stack and events in the same direction.

18. The length attribute of the javascript array can be read or written, and the length of the array is set to 0, all elements in the array can be cleared (excluding the array elements whose array subscript is not an integer .)

19. Although null and undefined are different, the operators "=" treat them as equal values (true is returned)

20. javascript packing and unpacking: converting the basic data type to the corresponding reference type is called packing. Conversely, converting the reference type to the corresponding value type is called unpacking.

21, JSON: Object constant & array constant
Javascript object notation javascript <object Representation Method>
JSON is a simple data exchange protocol developed by javascript. Its data format is a legal javascript Object constant.

22. The absolute attribute works with left and top to create a "floating layer" effect. However, sometimes we need to focus on the floating effect of a container, rather than the window. At this time, the calculation of height and width is not only troublesome, but also almost impossible to achieve the perfect effect. You only need to set the position of the style attribute at the upper level to relative. For example, use div to nest ul and li

23. DOM element movement: object. appendChild (object. firstChild) You can move the first element to the end, but it is removed when the table element is applied </body> outside the tag (not displayed ).. therefore, the MoveRow method should be used to move rows in the table element.

Related Article

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.