บทสรุป Object มาตรฐานใน javascript
ออปเจ็คต์มาตรฐานในจาวาสคริปต์ (จาก w3schools.com)
ในบทความนี้ก็จะเป็นส่วนสุดท้ายสำหรับ javascript เบื้องต้น แล้วนะครับ เป็นการรวม method และ function มาตรฐาน ที่ javascript ได้เตรียมไว้ให้เรียกใช้งานได้ซึ่งได้นำมาจากเว็บ w3school.com นะครับ หลังจากบทความนี้จบ ก็จะเป็นตัวอย่าง ในการใช้งานสำคัญของ javascript อื่นๆนะครับ
Array Object Methods
FF: Firefox, N: Netscape, IE: Internet Explorer
|
Method |
Description |
FF |
N |
IE |
|
Joins two or more arrays and returns the result |
1 |
4 |
4 |
|
|
Puts all the elements of an array into a string. The elements are separated by a specified delimiter |
1 |
3 |
4 |
|
|
Removes and returns the last element of an array |
1 |
4 |
5.5 |
|
|
Adds one or more elements to the end of an array and returns the new length |
1 |
4 |
5.5 |
|
|
Reverses the order of the elements in an array |
1 |
3 |
4 |
|
|
Removes and returns the first element of an array |
1 |
4 |
5.5 |
|
|
Returns selected elements from an existing array |
1 |
4 |
4 |
|
|
Sorts the elements of an array |
1 |
3 |
4 |
|
|
Removes and adds new elements to an array |
1 |
4 |
5.5 |
|
|
Represents the source code of an object |
1 |
4 |
- |
|
|
Converts an array to a string and returns the result |
1 |
3 |
4 |
|
|
Adds one or more elements to the beginning of an array and returns the new length |
1 |
4 |
6 |
|
|
Returns the primitive value of an Array object |
1 |
2 |
4 |
Array Object Properties
|
Property |
Description |
FF |
N |
IE |
|
A reference to the function that created the object |
1 |
2 |
4 |
|
|
index |
|
1 |
3 |
4 |
|
input |
|
1 |
3 |
4 |
|
Sets or returns the number of elements in an array |
1 |
2 |
4 |
|
|
Allows you to add properties and methods to the object |
1 |
2 |
4 |
Boolean Object Methods
FF: Firefox, N: Netscape, IE: Internet Explorer
|
Method |
Description |
FF |
N |
IE |
|
Represents the source code of an object |
1 |
4 |
- |
|
|
Converts a Boolean value to a string and returns the result |
1 |
4 |
4 |
|
|
Returns the primitive value of a Boolean object |
1 |
4 |
4 |
Boolean Object Properties
|
Property |
Description |
FF |
N |
IE |
|
A reference to the function that created the object |
1 |
2 |
4 |
|
|
Allows you to add properties and methods to the object |
1 |
2 |
4 |
Date Object Methods
FF: Firefox, N: Netscape, IE: Internet Explorer
|
Method |
Description |
FF |
N |
IE |
|
Returns today’s date and time |
1 |
2 |
3 |
|
|
Returns the day of the month from a Date object (from 1-31) |
1 |
2 |
3 |
|
|
Returns the day of the week from a Date object (from 0-6) |
1 |
2 |
3 |
|
|
Returns the month from a Date object (from 0-11) |
1 |
2 |
3 |
|
|
Returns the year, as a four-digit number, from a Date object |
1 |
4 |
4 |
|
|
Returns the year, as a two-digit or a four-digit number, from a Date object. Use getFullYear() instead !! |
1 |
2 |
3 |
|
|
Returns the hour of a Date object (from 0-23) |
1 |
2 |
3 |
|
|
Returns the minutes of a Date object (from 0-59) |
1 |
2 |
3 |
|
|
Returns the seconds of a Date object (from 0-59) |
1 |
2 |
3 |
|
|
Returns the milliseconds of a Date object (from 0-999) |
1 |
4 |
4 |
|
|
Returns the number of milliseconds since |
1 |
2 |
3 |
|
|
Returns the difference in minutes between local time and Greenwich Mean Time (GMT) |
1 |
2 |
3 |
|
|
Returns the day of the month from a Date object according to universal time (from 1-31) |
1 |
4 |
4 |
|
|
Returns the day of the week from a Date object according to universal time (from 0-6) |
1 |
4 |
4 |
|
|
Returns the month from a Date object according to universal time (from 0-11) |
1 |
4 |
4 |
|
|
Returns the four-digit year from a Date object according to universal time |
1 |
4 |
4 |
|
|
Returns the hour of a Date object according to universal time (from 0-23) |
1 |
4 |
4 |
|
|
Returns the minutes of a Date object according to universal time (from 0-59) |
1 |
4 |
4 |
|
|
Returns the seconds of a Date object according to universal time (from 0-59) |
1 |
4 |
4 |
|
|
Returns the milliseconds of a Date object according to universal time (from 0-999) |
1 |
4 |
4 |
|
|
Takes a date string and returns the number of milliseconds since |
1 |
2 |
3 |
|
|
Sets the day of the month in a Date object (from 1-31) |
1 |
2 |
3 |
|
|
Sets the month in a Date object (from 0-11) |
1 |
2 |
3 |
|
|
Sets the year in a Date object (four digits) |
1 |
4 |
4 |
|
|
Sets the year in the Date object (two or four digits). Use setFullYear() instead !! |
1 |
2 |
3 |
|
|
Sets the hour in a Date object (from 0-23) |
1 |
2 |
3 |
|
|
Set the minutes in a Date object (from 0-59) |
1 |
2 |
3 |
|
|
Sets the seconds in a Date object (from 0-59) |
1 |
2 |
3 |
|
|
Sets the milliseconds in a Date object (from 0-999) |
1 |
4 |
4 |
|
|
Calculates a date and time by adding or subtracting a specified number of milliseconds to/from |
1 |
2 |
3 |
|
|
Sets the day of the month in a Date object according to universal time (from 1-31) |
1 |
4 |
4 |
|
|
Sets the month in a Date object according to universal time (from 0-11) |
1 |
4 |
4 |
|
|
Sets the year in a Date object according to universal time (four digits) |
1 |
4 |
4 |
|
|
Sets the hour in a Date object according to universal time (from 0-23) |
1 |
4 |
4 |
|
|
Set the minutes in a Date object according to universal time (from 0-59) |
1 |
4 |
4 |
|
|
Set the seconds in a Date object according to universal time (from 0-59) |
1 |
4 |
4 |
|
|
Sets the milliseconds in a Date object according to universal time (from 0-999) |
1 |
4 |
4 |
|
|
Represents the source code of an object |
1 |
4 |
- |
|
|
Converts a Date object to a string |
1 |
2 |
4 |
|
|
Converts a Date object, according to Greenwich time, to a string. Use toUTCString() instead !! |
1 |
2 |
3 |
|
|
Converts a Date object, according to universal time, to a string |
1 |
4 |
4 |
|
|
Converts a Date object, according to local time, to a string |
1 |
2 |
3 |
|
|
Takes a date and returns the number of milliseconds since |
1 |
2 |
3 |
|
|
Returns the primitive value of a Date object |
1 |
2 |
4 |
Date Object Properties
|
Property |
Description |
FF |
N |
IE |
|
A reference to the function that created the object |
1 |
4 |
4 |
|
|
Allows you to add properties and methods to the object |
1 |
3 |
4 |
Math Object Methods
FF: Firefox, N: Netscape, IE: Internet Explorer
|
Method |
Description |
FF |
N |
IE |
|
Returns the absolute value of a number |
1 |
2 |
3 |
|
|
Returns the arccosine of a number |
1 |
2 |
3 |
|
|
Returns the arcsine of a number |
1 |
2 |
3 |
|
|
Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians |
1 |
2 |
3 |
|
|
Returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians |
1 |
2 |
3 |
|
|
Returns the value of a number rounded upwards to the nearest integer |
1 |
2 |
3 |
|
|
Returns the cosine of a number |
1 |
2 |
3 |
|
|
Returns the value of Ex |
1 |
2 |
3 |
|
|
Returns the value of a number rounded downwards to the nearest integer |
1 |
2 |
3 |
|
|
Returns the natural logarithm (base E) of a number |
1 |
2 |
3 |
|
|
Returns the number with the highest value of x and y |
1 |
2 |
3 |
|
|
Returns the number with the lowest value of x and y |
1 |
2 |
3 |
|
|
Returns the value of x to the power of y |
1 |
2 |
3 |
|
|
Returns a random number between 0 and 1 |
1 |
2 |
3 |
|
|
Rounds a number to the nearest integer |
1 |
2 |
3 |
|
|
Returns the sine of a number |
1 |
2 |
3 |
|
|
Returns the square root of a number |
1 |
2 |
3 |
|
|
Returns the tangent of an angle |
1 |
2 |
3 |
|
|
Represents the source code of an object |
1 |
4 |
- |
|
|
Returns the primitive value of a Math object |
1 |
2 |
4 |
Math Object Properties
|
Property |
Description |
FF |
N |
IE |
|
A reference to the function that created the object |
1 |
2 |
4 |
|
|
E |
Returns Euler’s constant (approx. 2.718) |
1 |
2 |
3 |
|
LN2 |
Returns the natural logarithm of 2 (approx. 0.693) |
1 |
2 |
3 |
|
LN10 |
Returns the natural logarithm of 10 (approx. 2.302) |
1 |
2 |
3 |
|
LOG2E |
Returns the base-2 logarithm of E (approx. 1.442) |
1 |
2 |
3 |
|
LOG10E |
Returns the base-10 logarithm of E (approx. 0.434) |
1 |
2 |
3 |
|
PI |
Returns PI (approx. 3.14159) |
1 |
2 |
3 |
|
Allows you to add properties and methods to the object |
1 |
2 |
4 |
|
|
SQRT1_2 |
Returns the square root of 1/2 (approx. 0.707) |
1 |
2 |
3 |
|
SQRT2 |
Returns the square root of 2 (approx. 1.414) |
1 |
2 |
3 |
String Object Methods
FF: Firefox, N: Netscape, IE: Internet Explorer
|
Method |
Description |
FF |
N |
IE |
|
Creates an HTML anchor |
1 |
2 |
3 |
|
|
Displays a string in a big font |
1 |
2 |
3 |
|
|
Displays a blinking string |
1 |
2 |
|
|
|
Displays a string in bold |
1 |
2 |
3 |
|
|
Returns the character at a specified position |
1 |
2 |
3 |
|
|
Returns the Unicode of the character at a specified position |
1 |
4 |
4 |
|
|
Joins two or more strings |
1 |
4 |
4 |
|
|
Displays a string as teletype text |
1 |
2 |
3 |
|
|
Displays a string in a specified color |
1 |
2 |
3 |
|
|
Displays a string in a specified size |
1 |
2 |
3 |
|
|
Takes the specified Unicode values and returns a string |
1 |
4 |
4 |
|
|
Returns the position of the first occurrence of a specified string value in a string |
1 |
2 |
3 |
|
|
Displays a string in italic |
1 |
2 |
3 |
|
|
Returns the position of the last occurrence of a specified string value, searching backwards from the specified position in a string |
1 |
2 |
3 |
|
|
Displays a string as a hyperlink |
1 |
2 |
3 |
|
|
Searches for a specified value in a string |
1 |
4 |
4 |
|
|
Replaces some characters with some other characters in a string |
1 |
4 |
4 |
|
|
Searches a string for a specified value |
1 |
4 |
4 |
|
|
Extracts a part of a string and returns the extracted part in a new string |
1 |
4 |
4 |
|
|
Displays a string in a small font |
1 |
2 |
3 |
|
|
Splits a string into an array of strings |
1 |
4 |
4 |
|
|
Displays a string with a strikethrough |
1 |
2 |
3 |
|
|
Displays a string as subscript |
1 |
2 |
3 |
|
|
Extracts a specified number of characters in a string, from a start index |
1 |
4 |
4 |
|
|
Extracts the characters in a string between two specified indices |
1 |
2 |
3 |
|
|
Displays a string as superscript |
1 |
2 |
3 |
|
|
Displays a string in lowercase letters |
1 |
2 |
3 |
|
|
Displays a string in uppercase letters |
1 |
2 |
3 |
|
|
Represents the source code of an object |
1 |
4 |
- |
|
|
Returns the primitive value of a String object |
1 |
2 |
4 |
String Object Properties
|
Property |
Description |
FF |
N |
IE |
|
A reference to the function that created the object |
1 |
4 |
4 |
|
|
Returns the number of characters in a string |
1 |
2 |
3 |
|
|
Allows you to add properties and methods to the object |
1 |
2 |
4 |
Top-level Functions
FF: Firefox, N: Netscape, IE: Internet Explorer
|
Function |
Description |
FF |
N |
IE |
|
Decodes an encoded URI |
1 |
4 |
5.5 |
|
|
Decodes an encoded URI component |
1 |
4 |
5.5 |
|
|
Encodes a string as a URI |
1 |
4 |
5.5 |
|
|
Encodes a string as a URI component |
1 |
4 |
5.5 |
|
|
Encodes a string |
1 |
- |
3 |
|
|
Evaluates a string and executes it as if it was script code |
1 |
2 |
3 |
|
|
Checks if a value is a finite number |
1 |
4 |
4 |
|
|
Checks if a value is not a number |
1 |
2 |
3 |
|
|
Converts an object’s value to a number |
1 |
|
|
|
|
Parses a string and returns a floating point number |
1 |
2 |
3 |
|
|
Parses a string and returns an integer |
1 |
2 |
3 |
|
|
Converts an object’s value to a string |
1 |
|
|
|
|
Decodes a string encoded by escape() |
1 |
- |
3 |
Top-level Properties
|
Property |
Description |
FF |
N |
IE |
|
A numeric value that represents positive or negative infinity |
1 |
4 |
4 |
|
|
Indicates that a value is “Not a Number” |
1 |
4 |
4 |
|
|
Indicates that a variable has not been assigned a value |
1 |
4 |
5.5 |
หมายเหตุ เอกสารนี้สรุปและมีข้อมูลต่างๆ จากเว็บไซต์ต่อไปนี้
http://www.w3schools.com/js_ref/default.asp
http://www.w3schools.com/js/default.asp