Window Object Properties
Window Object Properties
Property closed defaultStatus document frames history innerHeight innerWidth length location name navigator opener outerHeight outerWidth pageXOffset pageYOffset parent Description Returns a Boolean value indicating whether a window has been closed or not Sets or returns the default text in the statusbar of a window Returns the Document object for the window (See Document object) Returns an array of all the frames (including iframes) in the current window Returns the History object for the window (See History object) Sets or returns the the inner height of a window's content area Sets or returns the the inner width of a window's content area Returns the number of frames (including iframes) in a window Returns the Location object for the window (See Location object) Sets or returns the name of a window Returns the Navigator object for the window (See Navigator object) Returns a reference to the window that created the window Sets or returns the outer height of a window, including toolbars/scrollbars Sets or returns the outer width of a window, including toolbars/scrollbars Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window Returns the parent window of the current window
Returns the Screen object for the window (See Screen object) Returns the x coordinate of the window relative to the screen Returns the y coordinate of the window relative to the screen Returns the x coordinate of the window relative to the screen Returns the y coordinate of the window relative to the screen Returns the current window Sets the text in the statusbar of a window Returns the topmost browser window
clearInterval( Clears a timer set with setInterval() ) clearTimeout( Clears a timer set with setTimeout() ) close() confirm() Closes the current window Displays a dialog box with a message and an OK and a Cancel button
createPopup( Creates a pop-up window ) focus() moveBy() moveTo() open() print() Sets focus to the current window Moves a window relative to its current position Moves a window to the specified position Opens a new browser window Prints the content of the current window
Displays a dialog box that prompts the visitor for input Resizes the window by the specified pixels Resizes the window to the specified width and height
Scrolls the content by the specified number of pixels Scrolls the content to the specified coordinates Calls a function or evaluates an expression at specified intervals (in milliseconds) Calls a function or evaluates an expression after a specified number of milliseconds
getElementsByTagN Accesses all elements with a specified tagname ame() open() write() writeln() Opens an output stream to collect the output from document.write() or document.writeln() Writes HTML expressions or JavaScript code to a document Same as write(), but adds a newline character after each statement
replace()
POSITIVE_INFINIT Represents infinity (returned on overflow) Y prototype Allows you to add properties and methods to an object
Formats a number to x length Converts a Number object to a string Returns the primitive value of a Number object
getMilliseconds() Returns the milliseconds (from 0-999) getMinutes() getMonth() getSeconds() getTime() getTimezoneOffs et() getUTCDate() getUTCDay() getUTCFullYear() Returns the minutes (from 0-59) Returns the month (from 0-11) Returns the seconds (from 0-59) Returns the number of milliseconds since midnight Jan 1, 1970 Returns the time difference between GMT and local time, in minutes Returns the day of the month, according to universal time (from 1-31) Returns the day of the week, according to universal time (from 0-6) Returns the year, according to universal time (four digits)
getUTCHours()
getUTCMillisecon Returns the milliseconds, according to universal time ds() (from 0-999) getUTCMinutes() getUTCMonth() getUTCSeconds() getYear() parse() setDate() setFullYear() setHours() setMilliseconds() setMinutes() setMonth() setSeconds() setTime() Returns the minutes, according to universal time (from 0-59) Returns the month, according to universal time (from 0-11) Returns the seconds, according to universal time (from 0-59) Deprecated. Use the getFullYear() method instead Parses a date string and returns the number of milliseconds since midnight of January 1, 1970 Sets the day of the month (from 1-31) Sets the year (four digits) Sets the hour (from 0-23) Sets the milliseconds (from 0-999) Set the minutes (from 0-59) Sets the month (from 0-11) Sets the seconds (from 0-59) Sets a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970 Sets the day of the month, according to universal time (from 1-31) Sets the year, according to universal time (four digits) Sets the hour, according to universal time (from 0-23) Sets the milliseconds, according to universal time (from 0-999) Set the minutes, according to universal time (from 059) Sets the month, according to universal time (from 0-11) Set the seconds, according to universal time (from 0-
59) setYear() toDateString() toGMTString() toLocaleDateStri ng() toLocaleTimeStri ng() toLocaleString() toString() toTimeString() toUTCString() Deprecated. Use the setFullYear() method instead Converts the date portion of a Date object into a readable string Deprecated. Use the toUTCString() method instead Returns the date portion of a Date object as a string, using locale conventions Returns the time portion of a Date object as a string, using locale conventions Converts a Date object to a string, using locale conventions Converts a Date object to a string Converts the time portion of a Date object to a string Converts a Date object to a string, according to universal time Returns the number of milliseconds in a date string since midnight of January 1, 1970, according to universal time Returns the primitive value of a Date object
UTC() valueOf()
max(x,y,z,...,n Returns the number with the highest value ) min(x,y,z,...,n Returns the number with the lowest value ) pow(x,y) random() round(x) Returns the value of x to the power of y Returns a random number between 0 and 1 Rounds x to the nearest integer
Returns the sine of x (x is in radians) Returns the square root of x Returns the tangent of an angle
replace()
substring()
toLowerCase( Converts a string to lowercase letters ) toUpperCase( Converts a string to uppercase letters ) valueOf() Returns the primitive value of a String object
Brackets
Brackets are used to find a range of characters: Expression [abc] [^abc] [0-9] [A-Z] [a-z] [A-z] [adgk] [^adgk] (red|blue| green) Description Find any character between the brackets Find any character not between the brackets Find any digit from 0 to 9 Find any character from uppercase A to uppercase Z Find any character from lowercase a to lowercase z Find any character from uppercase A to lowercase z Find any character in the given set Find any character outside the given set Find any of the alternatives specified
Metacharacters
Metacharacters are characters with a special meaning: Metacharacter . \w \W \d \D \s \S \b \B \0 \n \f \r \t \v \xxx \xdd \uxxxx Description Find a single character, except newline or line terminator Find a word character Find a non-word character Find a digit Find a non-digit character Find a whitespace character Find a non-whitespace character Find a match at the beginning/end of a word Find a match not at the beginning/end of a word Find a NUL character Find a new line character Find a form feed character Find a carriage return character Find a tab character Find a vertical tab character Find the character specified by an octal number xxx Find the character specified by a hexadecimal number dd Find the Unicode character specified by a hexadecimal number xxxx
Quantifiers
Quantifier n+ n* n? n{X} n{X,Y} n{X,} n$ ^n ?=n ?!n Description Matches any string that contains at least one n Matches any string that contains zero or more occurrences of n Matches any string that contains zero or one occurrences of n Matches any string that contains a sequence of X n's Matches any string that contains a sequence of X or Y n's Matches any string that contains a sequence of at least X n's Matches any string with n at the end of it Matches any string with n at the beginning of it Matches any string that is followed by a specific string n Matches any string that is not followed by a specific string n
exec() test()
Tests for a match in a string. Returns the first match Tests for a match in a string. Returns true or false
encodeURIComponent( Encodes a URI component ) escape() eval() isFinite() isNaN() Number() parseFloat() parseInt() String() unescape() Encodes a string Evaluates a string and executes it as if it was script code Determines whether a value is a finite, legal number Determines whether a value is an illegal number Converts an object's value to a number Parses a string and returns a floating point number Parses a string and returns an integer Converts an object's value to a string Decodes an encoded string
Document Object Collections Collection anchors[] forms[] images[] links[] Description Returns an array of all the anchors in the document Returns an array of all the forms in the document Returns an array of all the images in the document Returns an array of all the links in the document
Document Object Properties Property cookie documentMode domain lastModified readyState referrer title URL Description Returns all name/value pairs of cookies in the document Returns the mode used by the browser to render the document Returns the domain name of the server that loaded the document Returns the date and time the document was last modified Returns the (loading) status of the document Returns the URL of the document that loaded the current document Sets or returns the title of the document Returns the full URL of the document
Document Object Methods Method close() getElementById() Description Closes the output stream previously opened with document.open() Accesses the first element with the specified id
getElementsByNam Accesses all elements with a specified name e() getElementsByTagN Accesses all elements with a specified tagname
ame() open() write() writeln() Opens an output stream to collect the output from document.write() or document.writeln() Writes HTML expressions or JavaScript code to a document Same as write(), but adds a newline character after each statement