JavaScript common built-in objects

Source: Internet
Author: User

1. Time Objects

GetDate Get the current date

GetDay Gets the current day

GetHours gets the current hour

Getminutes gets the current minute

GetMonth Get the current month

Getseconds gets the current seconds

GetTime get current time (in milliseconds)

getTimezoneOffset getting the current time zone offset information

GetYear Get the current year

getFullYear returns the full four-digit year

<!--note the difference between getdate and getday, GETDATE returns the date (1~31), and Getday returns the day of the week--and

2.Math Object//is the math type, an instance of object

piπ value (approximately equal to 3.14159)

ABS () returns the absolute value of a number

Ceil () rounding up

Floor () Rounding down

Random () returns the number of 0~1 between a

Round () rounding

ValueOf () returns the original value of a mathematical object

3.String

Anchor () is used to convert a character into an HTML anchor tag.

Blink () turns the text in a string into a blinking font

Fixed () changes the text in a string to a constant-spacing font

CharAt (index) returns the character at the specified index

IndexOf (searchstring, StartIndex) returns the position of the first occurrence of the specified string in a string

Replace (regex, newstring) converts some characters in a string to other characters

Slice (StartIndex, EndIndex) extracts part of a character and returns the remainder in a character in the row

Split (delimiter) assigns a string to an array

substr (startIndex, length) from StartIndex, take length of characters

SUBSTRING (StartIndex, endIndex) characters from StartIndex and EndIndex, not including EndIndex

4.Array

Concat () means merging several arrays into an array

Jion (String) merges elements of an array into strings, string delimiters, or, if omitted, merge them directly no longer split

Pop () moves the last element in the array and returns the element

Push () adds one or more elements to the end of the array and returns the length value of the new array

Shift () moves the first element in an array and returns the element

Sort () sorts an array

Slice (start, end) returns a segment of the array

Splice () to delete and add new elements to an array

toLocaleString () returns the current system time

ToString () returns the original value of the array object

5. Events

A window event, only valid in body and FRAMESET elements

When the onload page or picture loading is complete

OnUnload when the user leaves the page

B Form Element event that is valid in the presentation element

OnChange when the contents of the box change

onsubmit When you click the Submit button

OnReset when the mouse button is re-clicked

Onselect Text is selected

When the onblur element loses focus

onfocus when an element gets focus

C Keyboard Events

onkeydown When you press the keyboard

onkeypress When you press or hold the keyboard

onkeyup When you release the keyboard

D Mouse Events

When an onclick mouse clicks on an object

Ondbclick when the mouse double-clicks an object

OnMouseDown when the mouse is pressed

OnMouseMove when the mouse is moved

onmouseout when the mouse leaves the element

onmouseover when the mouse passes through an element

OnMouseUp When the mouse button is released

e Other

onresize when a window or frame is redefined

Onsbort when a picture download is interrupted

OnError when loading a document or picture in case of an error

JavaScript common built-in objects

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.