JavaScript Properties and Methods
The reference below shows the Properties and Methods used in JavaScript and in the Browser object model.
Select objects to include in the reference:
Method/Property | Description |
---|---|
abs(x) Math | Returns the absolute value of x |
acos(x) Math | Returns the arccosine of x, in radians |
alert() Window | Displays an alert box with a message and an OK button |
appCodeName Navigator | Returns the code name of the browser |
applicationCache Window | |
appName Navigator | Returns the name of the browser |
appVersion Navigator | Returns the version information of the browser |
asin(x) Math | Returns the arcsine of x, in radians |
assign() Location | Loads a new document |
atan(x) Math | Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians |
atan2(y,x) Math | Returns the arctangent of the quotient of its arguments |
atob() Window | Decodes a base-64 encoded string |
availHeight Screen | Returns the height of the screen (excluding the Windows Taskbar) |
availWidth Screen | Returns the width of the screen (excluding the Windows Taskbar) |
back() History | Loads the previous URL in the history list |
blur() Window | Removes focus from the current window |
btoa() Window | Encodes a string in base-64 |
ceil(x) Math | Returns x, rounded upwards to the nearest integer |
charAt() String | Returns the character at the specified index |
charCodeAt() String | Returns the Unicode of the character at the specified index |
clearInterval() Window | Clears a timer set with setInterval() |
clearTimeout() Window | Clears a timer set with setTimeout() |
close() Window | Closes the current window |
closed Window | Returns a Boolean value indicating whether a window has been closed or not |
colorDepth Screen | Returns the bit depth of the color palette for displaying images |
compile() RegExpg | Deprecated in version 1.5. Compiles a regular expression |
concat() Array | Joins two or more arrays, and returns a copy of the joined arrays |
concat() String | Joins two or more strings, and returns a copy of the joined strings |
confirm() Window | Displays a dialog box with a message and an OK and a Cancel button |
constructor Array | Returns the function that created the Array object's prototype |
constructor Boolean | Returns the function that created the Boolean object's prototype |
constructor Date | Returns the function that created the Date object's prototype |
constructor Number | Returns the function that created the Number object's prototype |
constructor RegExpg | Returns the function that created the RegExp object's prototype |
constructor String | Returns the function that created the String object's prototype |
cookieEnabled Navigator | Determines whether cookies are enabled in the browser |
cos(x) Math | Returns the cosine of x (x is in radians) |
createPopup() Window | Creates a pop-up window |
decodeURI() Global | Decodes a URI |
decodeURIComponent() Global | Decodes a URI component |
defaultStatus Window | Sets or returns the default text in the statusbar of a window |
document Window | Returns the Document object for the window (See Document object) |
E Math | Returns Euler's number (approx. 2.718) |
encodeURI() Global | Encodes a URI |
encodeURIComponent() Global | Encodes a URI component |
escape() Global | Encodes a string. Deprecated in version 1.5. Use encodeURI() or encodeURIComponent()instead |
eval() Global | Evaluates a string and executes it as if it was script code |
exec() RegExpg | Tests for a match in a string. Returns the first match |
exp(x) Math | Returns the value of Ex |
external Window | |
floor(x) Math | Returns x, rounded downwards to the nearest integer |
focus() Window | Sets focus to the current window |
forward() History | Loads the next URL in the history list |
frameElement Window | |
frames Window | Returns an array of all the frames (including iframes) in the current window |
fromCharCode() String | Converts Unicode values to characters |
getDate() Date | Returns the day of the month (from 1-31) |
getDay() Date | Returns the day of the week (from 0-6) |
getFullYear() Date | Returns the year (four digits) |
getHours() Date | Returns the hour (from 0-23) |
getMilliseconds() Date | Returns the milliseconds (from 0-999) |
getMinutes() Date | Returns the minutes (from 0-59) |
getMonth() Date | Returns the month (from 0-11) |
getSeconds() Date | Returns the seconds (from 0-59) |
getTime() Date | Returns the number of milliseconds since midnight Jan 1, 1970 |
getTimezoneOffset() Date | Returns the time difference between UTC time and local time, in minutes |
getUTCDate() Date | Returns the day of the month, according to universal time (from 1-31) |
getUTCDay() Date | Returns the day of the week, according to universal time (from 0-6) |
getUTCFullYear() Date | Returns the year, according to universal time (four digits) |
getUTCHours() Date | Returns the hour, according to universal time (from 0-23) |
getUTCMilliseconds() Date | Returns the milliseconds, according to universal time (from 0-999) |
getUTCMinutes() Date | Returns the minutes, according to universal time (from 0-59) |
getUTCMonth() Date | Returns the month, according to universal time (from 0-11) |
getUTCSeconds() Date | Returns the seconds, according to universal time (from 0-59) |
getYear() Date | Deprecated. Use the getFullYear() method instead |
global RegExpg | Specifies if the 'g' modifier is set |
go() History | Loads a specific URL from the history list |
hash Location | Returns the anchor portion of a URL |
height Screen | Returns the total height of the screen |
history Window | Returns the History object for the window (See History object) |
host Location | Returns the hostname and port of a URL |
hostname Location | Returns the hostname of a URL |
href Location | Returns the entire URL |
ignoreCase RegExpg | Specifies if the 'i' modifier is set |
indexOf() Array | Search the array for an element and returns its position |
indexOf() String | Returns the position of the first found occurrence of a specified value in a string |
Infinity Global | A numeric value that represents positive/negative infinity |
innerHeight Window | Sets or returns the inner height of a window's content area |
innerWidth Window | Sets or returns the inner width of a window's content area |
isFinite() Global | Determines whether a value is a finite, legal number |
isNaN() Global | Determines whether a value is an illegal number |
javaEnabled() Navigator | Specifies whether or not the browser has Java enabled |
join() Array | Joins all elements of an array into a string |
language Navigator | Returns the language of the browser |
lastIndex RegExpg | Specifies the index at which to start the next match |
lastIndexOf() Array | Search the array for an element, starting at the end, and returns its position |
lastIndexOf() String | Returns the position of the last found occurrence of a specified value in a string |
length Array | Sets or returns the number of elements in an array |
length History | Returns the number of URLs in the history list |
length String | Returns the length of a string |
length Window | Returns the number of frames (including iframes) in a window |
LN10 Math | Returns the natural logarithm of 10 (approx. 2.302) |
LN2 Math | Returns the natural logarithm of 2 (approx. 0.693) |
localeCompare() String | Compares two strings in the current locale |
location Window | Returns the Location object for the window (See Location object) |
locationbar Window | |
log(x) Math | Returns the natural logarithm (base E) of x |
LOG10E Math | Returns the base-10 logarithm of E (approx. 0.434) |
LOG2E Math | Returns the base-2 logarithm of E (approx. 1.442) |
match() String | Searches for a match between a regular expression and a string, and returns the matches |
max(x,y,z,...,n) Math | Returns the number with the highest value |
MAX_VALUE Number | Returns the largest number possible in JavaScript |
menubar Window | |
min(x,y,z,...,n) Math | Returns the number with the lowest value |
MIN_VALUE Number | Returns the smallest number possible in JavaScript |
moveBy() Window | Moves a window relative to its current position |
moveTo() Window | Moves a window to the specified position |
multiline RegExpg | Specifies if the 'm' modifier is set |
name Window | Sets or returns the name of a window |
NaN Global | 'Not-a-Number' value |
NaN Number | Represents a 'Not-a-Number' value |
navigator Window | Returns the Navigator object for the window (See Navigator object) |
NEGATIVE_INFINITY Number | Represents negative infinity (returned on overflow) |
Number() Global | Converts an object's value to a number |
onafterprint Window | |
onbeforeprint Window | |
onbeforeunload Window | |
onhashchange Window | |
onLine Navigator | Boolean, returns true if the browser is on line, otherwise false. |
onmessage Window | |
onoffline Window | |
ononline Window | |
onpagehide Window | |
onpageshow Window | |
onpopstate Window | |
onresize Window | |
onstorage Window | |
onunload Window | |
open() Window | Opens a new browser window |
opener Window | Returns a reference to the window that created the window |
outerHeight Window | Sets or returns the outer height of a window, including toolbars/scrollbars |
outerWidth Window | Sets or returns the outer width of a window, including toolbars/scrollbars |
pageXOffset Window | Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window |
pageYOffset Window | Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window |
parent Window | Returns the parent window of the current window |
parse() Date | Parses a date string and returns the number of milliseconds since midnight of January 1, 1970 |
parseFloat() Global | Parses a string and returns a floating point number |
parseInt() Global | Parses a string and returns an integer |
pathname Location | Returns the path name of a URL |
personalbar Window | |
PI Math | Returns PI (approx. 3.14) |
pixelDepth Screen | Returns the color resolution (in bits per pixel) of the screen |
platform Navigator | Returns for which platform the browser is compiled |
pop() Array | Removes the last element of an array, and returns that element |
port Location | Returns the port number the server uses for a URL |
POSITIVE_INFINITY Number | Represents infinity (returned on overflow) |
pow(x,y) Math | Returns the value of x to the power of y |
print() Window | Prints the content of the current window |
product Navigator | Returns the engine name of the browser |
prompt() Window | Displays a dialog box that prompts the visitor for input |
protocol Location | Returns the protocol of a URL |
prototype Array | Allows you to add properties and methods to an Array object |
prototype Boolean | Allows you to add properties and methods to a Boolean object |
prototype Date | Allows you to add properties and methods to an object |
prototype Number | Allows you to add properties and methods to an object |
prototype String | Allows you to add properties and methods to an object |
push() Array | Adds new elements to the end of an array, and returns the new length |
pushState History | |
random() Math | Returns a random number between 0 and 1 |
reload() Location | Reloads the current document |
replace() Location | Replaces the current document with a new one |
replace() String | Searches for a match between a substring (or regular expression) and a string, and replaces the matched substring with a new substring |
replaceState History | |
resizeBy() Window | Resizes the window by the specified pixels |
resizeTo() Window | Resizes the window to the specified width and height |
reverse() Array | Reverses the order of the elements in an array |
round(x) Math | Rounds x to the nearest integer |
screen Window | Returns the Screen object for the window (See Screen object) |
screenLeft Window | Returns the x coordinate of the window relative to the screen |
screenTop Window | Returns the y coordinate of the window relative to the screen |
screenX Window | Returns the x coordinate of the window relative to the screen |
screenY Window | Returns the y coordinate of the window relative to the screen |
scroll() Window | |
scrollbars Window | |
scrollBy() Window | Scrolls the content by the specified number of pixels |
scrollTo() Window | Scrolls the content to the specified coordinates |
search Location | Returns the query portion of a URL |
search() String | Searches for a match between a regular expression and a string, and returns the position of the match |
self Window | Returns the current window |
setDate() Date | Sets the day of the month of a date object |
setFullYear() Date | Sets the year (four digits) of a date object |
setHours() Date | Sets the hour of a date object |
setInterval() Window | Calls a function or evaluates an expression at specified intervals (in milliseconds) |
setMilliseconds() Date | Sets the milliseconds of a date object |
setMinutes() Date | Set the minutes of a date object |
setMonth() Date | Sets the month of a date object |
setSeconds() Date | Sets the seconds of a date object |
setTime() Date | Sets a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970 |
setTimeout() Window | Calls a function or evaluates an expression after a specified number of milliseconds |
setUTCDate() Date | Sets the day of the month of a date object, according to universal time |
setUTCFullYear() Date | Sets the year of a date object, according to universal time (four digits) |
setUTCHours() Date | Sets the hour of a date object, according to universal time |
setUTCMilliseconds() Date | Sets the milliseconds of a date object, according to universal time |
setUTCMinutes() Date | Set the minutes of a date object, according to universal time |
setUTCMonth() Date | Sets the month of a date object, according to universal time |
setUTCSeconds() Date | Set the seconds of a date object, according to universal time |
setYear() Date | Deprecated. Use the setFullYear() method instead |
shift() Array | Removes the first element of an array, and returns that element |
showModalDialog Window | |
sin(x) Math | Returns the sine of x (x is in radians) |
slice() Array | Selects a part of an array, and returns the new array |
slice() String | Extracts a part of a string and returns a new string |
sort() Array | Sorts the elements of an array |
source RegExpg | Returns the text of the RegExp pattern |
splice() Array | Adds/Removes elements from an array |
split() String | Splits a string into an array of substrings |
sqrt(x) Math | Returns the square root of x |
SQRT1_2 Math | Returns the square root of 1/2 (approx. 0.707) |
SQRT2 Math | Returns the square root of 2 (approx. 1.414) |
state History | |
status Window | Sets the text in the statusbar of a window |
statusbar Window | |
stop() Window | Stops the window from loading |
String() Global | Converts an object's value to a string |
substr() String | Extracts the characters from a string, beginning at a specified start position, and through the specified number of character |
substring() String | Extracts the characters from a string, between two specified indices |
taintEnabled() Navigator | Removed in JavaScript version 1.2.Specifies whether the browser has data tainting enabled |
tan(x) Math | Returns the tangent of an angle |
test() RegExpg | Tests for a match in a string. Returns true or false |
toDateString() Date | Converts the date portion of a Date object into a readable string |
toExponential(x) Number | Converts a number into an exponential notation |
toFixed(x) Number | Formats a number with x numbers of digits after the decimal point |
toGMTString() Date | Deprecated. Use the toUTCString() method instead |
toISOString() Date | Returns the date as a string, using the ISO standard |
toJSON() Date | Returns the date as a string, formatted as a JSON date |
toLocaleDateString() Date | Returns the date portion of a Date object as a string, using locale conventions |
toLocaleLowerCase() String | Converts a string to lowercase letters, according to the host's locale |
toLocaleString() Date | Converts a Date object to a string, using locale conventions |
toLocaleTimeString() Date | Returns the time portion of a Date object as a string, using locale conventions |
toLocaleUpperCase() String | Converts a string to uppercase letters, according to the host's locale |
toLowerCase() String | Converts a string to lowercase letters |
top Window | Returns the topmost browser window |
toPrecision(x) Number | Formats a number to x length |
toString() Array | Converts an array to a string, and returns the resul |
toString() Boolean | Converts a Boolean value to a string, and returns the result |
toString() Date | Converts a Date object to a string |
toString() Number | Converts a Number object to a string |
toString() RegExpg | Returns the string value of the regular expression |
toString() String | Returns the value of a String object |
toTimeString() Date | Converts the time portion of a Date object to a string |
toUpperCase() String | Converts a string to uppercase letters |
toUTCString() Date | Converts a Date object to a string, according to universal time |
trim() String | Removes whitespace from both ends of a string |
undefined Global | Indicates that a variable has not been assigned a value |
unescape() Global | Decodes an encoded string. Deprecated in version 1.5. Use decodeURI() or decodeURIComponent()instead |
unshift() Array | Adds new elements to the beginning of an array, and returns the new length |
URLItils Location | |
userAgent Navigator | Returns the user-agent header sent by the browser to the server |
UTC() Date | Returns the number of milliseconds in a date string since midnight of January 1, 1970, according to universal time |
valueOf() Array | Returns the primitive value of an array |
valueOf() Boolean | Returns the primitive value of a Boolean object |
valueOf() Date | Returns the primitive value of a Date object |
valueOf() Number | Returns the primitive value of a Number object |
valueOf() String | Returns the primitive value of a String object |
width Screen | Returns the total width of the screen |
window Window |