Ruffy JavaScript Learning Notes _ Basics

Source: Internet
Author: User
Tags base64 readable javascript array
1,javascript's prototype Model: prototype needs a constructor to define a member of an object when implementing an object-oriented (like defining a Class), and the method is attached to the constructor's prototype.

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

3,CSS Box block Model:
The margin is used to set the distance between the edges of the space occupied by an element and the adjacent elements.
Border: Border used to set the line of an element
Padding used to set the distance between the element's content-element border
And the Background property is the content and padding area, which is the contents and the gap
The width and height of the attributes in the CSS refer to the width and height of the content area, which is IE, which is added to the top edge of Firefox.

4,system.drawing.imaging.bitmapdata.. Lock a bitmap into memory ...
There are two functions that lock the image data into memory
One is: Bitmap.lockbits (Rectangle rect,imagemode flags,pixelformat format)
Another is: Bitmap.lockbits (Rectangle rect,imagemode flags,pixelformat format,bimapbitdata bitmapData)
BitmapData has an important attribute Scan0, which is a pointer to the first position in the memory where the picture data resides. Use memory tracking to populate the address with the value of Scan0, and you can see the allocation of memory.
We can change the pixel value at the specified location with System.Runtime.InteropServices.Marshal.WriteByte (IntPtr ptr,byte val).
The INTPTR type is called a "platform-specific integer type" and is used for native resources, such as window handle sentences.

5, Reflection: Reflection is a runtime type discovery process. Reflection gives you a list of all the types that a given assembly contains, including the methods, fields, properties, and events defined in the given type. You can also dynamically discover a set of interfaces supported by a given class, the parameters of the method, and other relevant information such as the base class, namespaces, data listings, and more.
The for/in statement in javascript:
for (variable in obj)
Statement
One of the most useful features is that it can enumerate all enumerable properties of an object, including native and inherited properties, providing a powerful reflection mechanism for JavaScript.
For example:
--for (var each in document.body)
--document.write (each+ ":" +document.body[each]+<br/>);
--//Enumerate and print out all the properties of the body
Variable can be any expression ...
Like what:
--function keys (obj) {
--Var ret= new Array ();
--Var i=0;
--for (ret[i++] in obj)
--return ret;
-- }
The above function returns the properties of an object as an array.

6,html-table control cellpadding The distance between the contents of a cell and the cell
The CellSpacing property represents the distance between cells
Alignment is: Align is horizontally aligned with left right center (refers to the horizontal alignment of elements in a cell)
Vlign is vertically aligned with top bottom middle

7,base64: According to the definition of RFC2045, Base64 is defined as: Base64 content transfer encoding is designed to describe the 8-bit byte of any sequence as a form that is not easily recognized directly by the person. (The Base64 content-transfer-encoding is designed to represent arbitrary sequences of octets in a form "not" be Hu Manly readable.)

8,margin:0px auto up and down margin is 0px or so automatic adjustment.

The difference between opener and self in 9,js: opener a reference to < Opens the object > of the current window, and if the current window is opened by the user, the opener value is null
Self-referencing property, which is the application of the current Window object, is synonymous with the Window property.
(Self represents the window for itself, and opener represents the window that opens itself, such as window a opens window B. If you rely on the Window.Open method, the window b,self represents B itself, and opener represents window A.)

10,wnd.location.search.slice (1); Get the "?" on the Address bar. The string that follows, WND is a reference to a Window object.

11, the meaning of G in an expression
G/global represents a global search
I/ignore represents ignoring case
Combination of GI and above

12, forward check and reverse check
(? =pattern) (?! pattern) is not fetched, just to verify that the subsequent occurrence of the string is not expected

13,setcapture Mouse capture: Mouse capture (setcapture) is the role of capturing mouse events to the specified object in the current document. This object will receive all mouse events for the current application or for the entire system. SetCapture captures the following mouse events: onmousedown, onmouseup, onmousemove, onclick, ondblclick, onmouseover, and onmouseout.

14,javascript with the in delete and the object as a collection, it is convenient to implement a collection (delete operator deletes the specified object properties, array elements, or variables.) The delete succeeds returns true. Also returns true if the operand does not exist
For example:
---var aset= new Object ();
---sset["key"]=true; Inserts a new element (whether or not it already exists)
---if ("Key1" in Aset)
---delete aset["key1"]///If key1 exists, delete
---if (delete aset["Key2"])
---aset["key2"]=true; Delete original element, update Key2

15,js-0 and | Operations The former can convert a word Fu Yin to a number, which will be rounded.

16,[]: Accesses the binocular operators of objects and array elements.
When the second operand of [] is an object, its ToString () method is called first to convert, and if the conversion fails, the valueof () method is invoked to convert.

17,javascript exceptions are always propagated up the call stack, and event propagation is along the same direction.

The length property of the 18,javascript array is readable and writable, setting the length of the array to 0 to clear all elements of the array (excluding those array elements whose array subscript is not an integer).

19, although null and undefined are different but operator "= =" treats them as equal values (returns True)

20,javascript Boxing and unboxing: the operation of converting the base data type to the corresponding reference type is called boxing, whereas converting the reference type to the corresponding value type is called a unboxing.

21,json: Object Constants & Array Constants
JavaScript Object Notation javascript< Objects representation method >
JSON is a simple data exchange protocol developed by JavaScript, and its data format is a legitimate JavaScript object constant

The 22,absolute property is combined with left and top to make the relevant "suspended layer" effect. However, sometimes we need to focus on the suspension effect of a container, not the window. At this time, the calculation of height and width is not only troublesome, but also can hardly achieve the result. Just set the style attribute position to relative on the first level. such as with DIV nested UL and Li

23, about the movement of DOM elements: with Object.appendchild (object.firstchild) You can move the first element to the last, but this is applied on the table element outside the </body> label (not shown). So you should use the Moverow method when moving rows in a 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.