Array: Ordered collection of series elements
Property:
Length: Used to get the number of array elements, the largest subscript plus 1
Method:
Sort (function): In the case of unspecified sorting numbers, sorted by the alphabetical order of the elements, if not a string type, and then converted to a string;
Reverse (): Reverses the order of elements in an array;
Concat (Array1,arrayn): Used to merge n arrays into a array1 array;
Join (String): Used to combine elements of an array into strings, string as delimiters, or, if omitted, to merge directly without separating;
Slice (start,stop): Used to return elements from start to stop in an array, and if the argument is negative, the countdown start or stop element;
ToString (): Returns all elements of an array to a string separated by commas;
Strings (String)
Property:
Length: Used to return string lengths, as in arrays;
Method:
Anchor (): This method creates a tag like anchor in HTML, format <a name= "" .....>, Access String.anchor (Chorname) by the following methods
toUpperCase (): Converts a string to uppercase;
toLowerCase (): Converts a string to lowercase;
IndexOf (A,B): Looks up the position of character A in the string from the B character and returns, if B is omitted, the default from 0 position;
Chartat (i): Returns the first character of the string;
SUBSTRING (start,end): Returns all the characters from the Start-end in the string (but does not return the character of the end itself);
Sub (): Displays the specified string in subscript format;
Date: detailed demo see
To define a method:
A:var newdt=new Date ()--> creates a time object and assigns the value to the current time;
B:var newdt=new Date (milliseconds)--> creates a time object and sets the value of the object in milliseconds by the GTM delay time;
C:var newdt=new Date (string)--> uses a specific time string to assign a value to a newly created time object in a format that matches the parse method of the Date object;
D:var newdt=new date (year, month, day, hour, minute, second, millisecond)--> assigns values to objects in the order of year, month, day, hour, minute, second, millisecond;
Methods: Get time; set time; format conversion
A: Get Time
GetDate ()-----Get the current full 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 time
In contrast to the above, the get is replaced with set, such as GetDate ()---> setdate ()
C: Conversion methods
Togtmstring ()------A string converted to a Greenwich mean time expression;
toLocaleString ()----A string converted to local time expression
ToString ()----------convert time to String
Parse---------------read the time from the string that represents the time
UTC-----------------return the gap from Greenwich Mean time to a specified time in milliseconds
Math Mathematics:
Properties: Note that attributes in a mathematical object are read
E (=2.7182)------The bottom of the natural logarithm (specific meaning, I do not understand, alas, and mathematical close to the things I do not understand, depressed!) )
LN10 (=2.30259)---the natural logarithm of 10;
LN2 (=0.69315)-----The natural logarithm of 2;
Pi (=3.1415926)----PI
Square root of Sqrt1_2 (=0.7071)--1/2
SQRT2 (=1.4142)----square root of 2
LOG2E (=1.44269)---with 2 as the base, the logarithm of E
LOG10E (=0.43429)--logarithm of the base e of 10
Method: Actually use not much, depressed, all get out
Sin (a)----to find the sine of a
COS (a)------to find the cosine of a
Tan (a)------to find the tangent of a
ASIN (a)-----the inverse chord value of a
Atan (a)-----to find the inverse cosine value of a
EXP (a)------index of a
Log (a)------to find the natural logarithm of a
Pow (a,i)----to the I-side (the exponentiation) of a
Round (a)----rounding a
sqrt (a)-----find the square root of a
ABS (a)------to find the absolute value of a
Random ()----Take random numbers
Max (A,B)----take a larger number
Min (a,b)----take a smaller number
Note: The parameters of the function are floating-point types, and the trigonometric function is the radian value, not the degree
JavaScript's built-in functions
Escape () and unescape (): Encode and decode strings
Eval (String): Used to execute the operation or statement represented by a string
For example: Var a=0; var str1= "A+=a"; eval (str1);
parseint () and parsefloat (): Converts the value of a text box to an integer or floating-point number
Note: parseint () is not rounding the numbers, but cutting the tail
isNaN (): The complete E-text is (are not a number), as the name implies is to determine whether the string is a numeric, such as if (isNaN ("Sky-Piercing Series tutorial"))
Custom objects: Two methods of objects with initialization objects and defining constructors
A: Initializing objects
For example: Object ={Property 1: Value 1; Property 2: Value 2; Attribute N: Value n}, note that each property \ value pair is separated by semicolons;
B: Define the object of the constructor
For example:
function functions Name (property 1, Property 2, ...). Attribute N) {
this. Property 1 = property value 1;
this. Property 2 = property value 2;
This. Property N= property 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, but before the method calls the function, the function must already be defined, or there will be an error.
Just as you create a new instance for a custom function, you use the newly statement.
Browser objects
Window object: He belongs to the central class, at the highest level of all objects, plainly, without him, you all did not play;
Property:
Closed----------used to determine whether the window is closed;
ER----------Store () method to open the window's parent window;
Defaultstatus the information displayed by default---status bar;
Status----------information currently displayed in the State bar;
Document,location,history---Very important, later in detail, if you don't want to wait, just look here
Method:
Alert (text)-------------pops up a message box
Confirm (text)-----------Confirmation information box, parameter is confirmation information
Prompt (Text,default)----Pop-up input dialog box, parameter is the hint information and the default value
Document object: includes various features of the current Web page, such as title \url\ background \ Language \ Modify time, etc.
Property:
Title------------Document titles
LastModified-----File Last Modified
URL--------------The address of the page corresponding to the document
Cookie-----------used to create and get cookie information
bgcolor----------the background color of a document
Fgcolor----------Document foreground color
Location---------Save All page address information for the document
Alinkcolor-------Activate the color of the connection
LinkColor--------The color of the link
Vlinkcolor-------The colors of the links that have been browsed
Method:
Write (text)-----writes text or labels to a document without wrapping the line
Writeln (text)---Write text or labels to a document, wrapping at the last character
()----------Open a new document for example ("Address", "Window name", "style")
Close ()---------closes the current document
Location object: contains all page address information for the current document
Property:
Protocol-----------Communication Protocol
The host name of the Web server on which the host---------------page resides
Port number for Port---------------server communication
Pathname-----------The path to the document on the server
Hash---------------anchor information for page jumps
Searce-------------page submitted to the server for search information
Hostname-----------Host name and port number, separated by colons in the middle
href---------------full URL address
Method:
Assign (URL)--------Navigate the page to another address
Reload-------------Refresh Page
Replace (URL)-------Replace the current page with a page with the specified URL
History: This object includes previously accessed URL information
Attributes: Length, number of URLs returned
The Main method is Go (n), which loads a relative page by using this method