JS built-in objects:
● String objects: all string processing operations
● Math Object: handle all the math
Object ● Date: The date and time of processing storage, transformation and expression
● Array objects: to provide an array of models, ordered store large amounts of data
● Event Object: to provide a variety of processing information JavaScript event
String object
common methods:
length; (property) (returns the length of the string)
the toUpperCase (); (partially converted string to upper case letters)
the toLowerCase (); (characters lowercase letter string conversion section)
the charAt (index); (returns the specified position of the specified string if the index is not (0, length), an empty string) is returned
indexOf (substring, startpos); (startpos return starting position, position of the character or substring index)
split (Separator, limit); (Separator symbol is divided, limit a number of division)
substring (startPos, stoppos); (string extracted from the string between stoppos sartpos to, stoppos may omitted)
substr (the startPos, length); (starpos extracted from the beginning of a string of length length)
Math objects
commonly used methods:
Math.ceil (X) rounded up
Math.floor (x) rounded down
Math.round (x ) rounding;
Math.random (); random number (return (0,1) a random interval)
Math.max (x, Y) returns the larger number between x and Y
Math.min (x, Y) x and return smaller number between Y
a Date objects
(1) create a Date object
common actions
var date = new Date (); ( returns local time)
to customize the initial value of
var date = new Date (2012, 10, 1); // 2012 Nian 10 Yue 1 Ri
var date = new Date ( 'Oct 1, 2012'); // 2012 10 years Day dated. 1
(2) the method used
method to obtain time:
getDate (); (1-31 someday return value)
getDay (); ( returns a day 0-6)
the getMonth (); (returns the value of a number of 0-11)
the getFullYear (); (returns a four-digit year, such as 2017)
getHours (); (0-23 returns a one hour)
getMinutes (); (return on behalf of a number of 0-59 minutes)
getSeconds (); (return on behalf of a number of seconds 0-59)
getTime (); (returns from January 1, 1970 number of milliseconds between)
set time method:
setDate (12 is); (number of days that 12 is)
the setMonth (2);
setHours (14);
the setMinutes (22 is);
the array objects
create an array
var myArr = new new the array ();
var myarr = new Array ( "1" , "2", "3");
Common methods
arrayObject.concat (array1, array2, ..., arrayN) ( connecting a plurality of arrays)
arrayObject.join (separator) (The addition of an array of array elements delimiter)
arrayObject.reverse () (reversed array elements)
ArrayObject .slice (start, end) (select the part of the array from the start to end)
arrayObject.sort (method function) (method sorting function is specified in descending or ascending order, sort methods are the bubble sort)
the event object is
a window event
(only in the body and frameset element to be effective)
when onload page or image is loaded
when onunload user leaves the page
form elements event
(only valid in form elements)
onChange box contents change
onsubmit click on the submit button
when onreset re-click the mouse button
onselect text is selected when
onblur element loses focus
onfocus element gain focus when the
keyboard events
(at the base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, title elements in both invalid)
onkeydown press the keyboard when the button
when onkeypress hold down a keyboard key is pressed or
when a keyboard key is released onkeyup
(At base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, title elements in both invalid)
onclick mouse clicks an object
when the mouse double-click on an object ondblclick
onmousedown mouse is pressed
onmousemove mouse is moved
when the mouse leaves the element onmouseout
onmouseover mouse over the element
when you release the mouse button onmouseup
------ class against the war