/**************** From "Tian hongchuan "**************** *****/Http://www.cnblogs.com/thcjp/archive/2006/08/21/482606.html
Array: an ordered set of series elements;
Attribute:
Length: used to obtain the number of array elements, that is, the maximum subscript plus 1
Method:
Sort (function): If no sorting number is specified, it is arranged alphabetically by the elements. If it is not a string type, it is converted to a string;
Reverse (): reverses the order of elements in the array;
Concat (array1, arrayn): Used to combine n numbers and add them to the array1 array;
Join (string): Used to merge the elements in the array into a string, and the string is the separator. If any parameter is omitted, the elements are directly merged without additional points;
Slice (start, stop): Used to return the elements from start to stop in the array. If the parameter is negative, it indicates the reciprocal start or stop element;
Tostring (): returns a string of all elements in the array separated by commas;
String):
Attribute:
Length: returns the length of a string. It is used in the same way as an array;
Method:
Anchor (): This method creates a tag in the format of <a name = ""...> like the anchor in HTML, and accesses string. Anchor (chorname) using the following methods)
For example, document. Write ("to the day through. Net \ Ajax \ Atlas blog view more tutorials" + mylink. Link ("http://www.cnblogs.com/thcjp "))
Touppercase (): converts a string to uppercase;
Tolowercase (): converts a string to lowercase;
Indexof (A, B): searches for the position where character a appears in the string from character B and returns the result. If B is omitted, it searches from position 0 by default;
Chartat (I): returns the I-th character in the string;
Substring (START, end): returns all characters in the string between start and end (but does not return the character of end itself );
Sub (): displays the specified string in subscript format;
Date ):
Definition method:
A: var newdt = new date () --> Create a time object and assign a value to the current time;
B: var newdt = new date (milliseconds) --> Create time object, and set the object Value in milliseconds Based on the delay time of GTM;
C: var newdt = new date (string) --> assign values to the newly created time object using a specific time string. The format matches the parse method of the date object;
D: var newdt = new date (year, month, day, hour, minute, second, millisecond) --> by year, month, day, hour, minute, second, assign values to objects in milliseconds;
Method: minute acquisition time, set time, format conversion
A: Get time
Getdate () ----- get the current complete time;
Getyear () ------ get the current year
Getmonths () ---- get the current month
Getday () ------- get the current date day
Gethours () ----- get the current hour
Getminutes () --- get the current minute
Getseconds () --- get the current second
Gettime () ------ get the current time, in seconds
Gettimezoneoffset -- get the current time zone offset Information
B: set the time.
Replace get with set, for example, getdate () ---> setdate ()
C: Conversion Method
Togtmstring () ------ convert to the string of the Greenwich Mean Time expression;
Tolocalestring () ---- convert to a string expressed locally
Tostring () ---------- convert time to string
Parse --------------- read the time from the string that represents the time
UTC ----------------- returns the gap from Greenwich Mean Time to the specified time, in milliseconds
Math mathematics:
Attribute: note that attributes in a mathematical object refer to read attributes.
E (= 2.7182) ------ bottom of the natural logarithm (I don't understand what it means, alas, I don't understand anything close to mathematics, I'm depressed !)
Ln10 (= 2.30259) --- the natural logarithm of 10;
Ln2 (= 0.69315) ----- natural logarithm of 2;
Pi (= 3.1415926) ---- circumference Rate
Sqrt1_2 (= 0.7071) -- square root of 1/2
Sqrt2 (= 1.4142) ---- the square root of 2
Log2e (= 1.44269) --- base on 2, logarithm of E
Log10e (= 0.43429) -- base 10 logarithm of E
Method: Actually, I don't have much to use. I'm depressed. Let's get it all out.
Sin (a) ---- returns the sine of.
Cos (a) ------ calculate the cosine of
Tan (a) ------ returns the tangent of
Asin (a) ----- returns the arc sine of.
Atan (a) ----- returns the arc cosine of.
Exp (a) ------ calculate the index of
Log (a) ------ calculate the natural logarithm of
Pow (A, I) ---- calculate the I power of a (multiplication)
Round (a) ---- rounding
SQRT (a) ----- calculate the square root of
ABS (a) ------ calculate the absolute value of
Random () ---- Random Number
Max (a, B) ---- take a large number
Min (a, B) ---- take a smaller number
Note: All function parameters are of the floating point type. The trigonometric function parameters are radians, rather than degrees.
Javascript built-in functions
Escape () and Unescape (): encoding and decoding strings
Eval (string): used to execute operations or statements represented by strings
For example: var a = 0; var str1 = "A + = A"; EVAL (str1 );
Parseint () and parsefloat (): Convert the value of the text box to an integer or floating point number.
Note: parseint () is not used to round the number, but to cut the end.
Isnan (): The complete e is (is not a number). As the name suggests, it is used to determine whether the string is a number, for example, if (isnan ("tianbang series tutorial "))
Custom object:There are two methods: initialization object and Object Defining Constructor
A: initialization object
Example: object = {property 1: value 1; Property 2: Value 2 ;...... attribute N: value n}. Note that each attribute \ value pair is separated by a semicolon;
B: define the object of the constructor.
For example:
Function Name (attribute 1, attribute 2 ,... Attribute N ){
This. Attribute 1 = attribute value 1;
This. Attribute 2 = attribute value 2;
This. Attribute n = attribute value N;
This. method name 1 = function name 1;
This. method name 2 = function name 2;
}
Note: The method name and function name can have the same name. However, before calling a function, the function must be defined. Otherwise, an error occurs.
The new statement is used to create a new instance for a custom function.
Browser object
Window object: he belongs to the central level and is at the highest level of all objects. To put it bluntly, you can't play without him;
Attributes: mainly include:
Closed ---------- used to determine whether the window is closed;
Opener ---------- store the open () method to open the parent window of the window;
Defaultstatus --- information displayed by default in the status bar;
Status ---------- information currently displayed in the status bar;
Document, location, history --- very important. If you don't want to wait for it, read it here.
Method:
Alert (text) ------------- a prompt box is displayed.
Confirm (text) ----------- confirmation information box, the parameter is confirmation Information
Prompt (text, default) ---- the input dialog box is displayed. The parameters are the prompt information and default values.
Document Object: contains various features of the current webpage, such as the title, URL, background, language, and modification time.
Attribute:
Title ------------ document title
Lastmodified ----- last modification time of the object
URL -------------- URL of the document
Cookie ----------- create and obtain Cookie Information
Bgcolor ---------- background color of the document
Fgcolor ---------- foreground color of the document
Location --------- save all the page address information of the document
Alinkcolor ------- activation connection color
Linkcolor -------- link color
Vlinkcolor ------- color of the browsed Link
Method:
Write (text) ----- write text or labels to the document without line breaks
Writeln (text) --- write text or tags to the document and wrap the line at the last character
Open () ---------- open a new document, such as open ("Address", "window name", "style ")
Close () --------- close the current document
Location object:Contains all the page addresses of the current document
Attribute:
Protocol ----------- communication protocol
Host --------------- Host Name of the Web server where the page is located
Port --------------- port number for server communication
Pathname ----------- path of the document on the server
Hash --------------- information about the page Jump anchor tag
Searce ------------- information submitted to the server for search
Hostname ----------- host name and port number, separated by a colon
Href --------------- complete URL
Method:
Assign (URL) -------- navigate the page to another address
Reload ------------- refresh the page
Replace (URL) ------- Replace the current page with the specified URL
History: This object includes URL information previously accessed.
Attribute: length, number of returned URLs. The method is mainly go (N). This method is used to load the relative page.
/**************** From "Tian hongchuan "**************** *****/
Http://www.cnblogs.com/thcjp/archive/2006/08/21/482606.html