Professional Documents
Culture Documents
Object toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable String charAt charCodeAt fromCharCode concat indexOf lastIndexOf localeCompare match replace search slice split substring substr toLowerCase toUpperCase toLocaleLowerCase toLocaleUpperCase RegEx test match exec Array concat join push pop reverse shift slice sort splice unshift Number toFixed toExponential toPrecision Date parse toDateString toTimeString getDate getDay getFullYear getHours getMilliseconds getMinutes getMonth getSeconds getTime getTimezoneOffset getYear setDate setHours setMilliseconds setMinutes setMonth setSeconds setYear toLocaleTimeString
DOM Methods
JavaScript
XMLHttpRequest Safari, Mozilla, Opera: var req = new XMLHttpRequest(); Internet Explorer: var req = new ActiveXObject("Microsoft.XMLHTTP"); XMLHttpRequest Object Methods
Document clear createDocument createDocumentFragment createElement createEvent createEventObject createRange createTextNode getElementsByTagName getElementById write Node addEventListener appendChild attachEvent cloneNode createTextRange detachEvent dispatchEvent fireEvent getAttributeNS getAttributeNode hasChildNodes hasAttribute hasAttributes insertBefore removeChild removeEventListener replaceChild scrollIntoView Form submit DOM Collections item Range collapse createContextualFragment moveEnd moveStart parentElement select setStartBefore Style getPropertyValue setProperty Event initEvent preventDefault stopPropagation XMLSerializer serializeToString XMLHTTP open send XMLDOM loadXML DOMParser parseFromString
Between 3 and 6 of a !(pattern) "Not" prefix. Apply rule when URL does not match pattern. EVENT HANDLERS
onMouseDown onMouseMove onMouseOut onMouseOver onMouseUp onMove onReset onResize onSelect onSubmit onUnload
onBlur onChange onClick onDblClick onDragDrop onError onFocus onKeyDown onKeyPress onKeyUp onLoad
Functions
Window alert blur clearTimeout close focus open print setTimeout Built In eval parseInt parseFloat isNaN isFinite decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape FUNCTIONS AND METHODS A method is a type of function, associated with an object. A normal function is not associated with an object. Available free from AddedBytes.com
Regular Expressions Anchors ^ \A $ \Z \b \B \< \> Start of string, or start of line in multi-line pattern Start of string End of string, or end of line in multi-line pattern End of string Word boundary Not word boundary Start of word End of word
Regular Expressions Quantifiers * + ? {3} {3,} {3,5} 0 or more 1 or more 0 or 1 Exactly 3 3 or more 3, 4 or 5
Regular Expressions Groups and Ranges . (a|b) (...) (?:...) [abc] [^abc] [a-q] [A-Q] Any character except new line (\n) a or b Group Passive (non-capturing) group Range (a or b or c) Not a or b or c Letter from a to q Upper case letter from A to Q Digit from 0 to 7 nth group/subpattern
[0-7] \n
Regular Expressions Character Classes \c \s \S \d \D \w \W \x \O Control character White space Not white space Digit Not digit Word Not word Hexadecimal digit Octal digit
^ $ ( ) <
[ { \ | >
. * + ?
Ranges are inclusive. Regular Expressions Pattern Modifiers g i m Global match Case-insensitive Multiple lines Treat string as single line Allow comments and white space in pattern Evaluate replacement Ungreedy pattern
The escape character is usually the backslash - \. Regular Expressions Special Characters \n \r \t New line Carriage return Tab Vertical tab Form feed Octal character xxx Hex character hh
s x e U
Regular Expressions POSIX [:upper:] [:lower:] [:alpha:] [:alnum:] [:digit:] [:xdigit:] [:punct:] [:blank:] [:space:] [:cntrl:] [:graph:] [:print:] [:word:] Upper case letters Lower case letters All letters Digits and letters Digits Hexadecimal digits Punctuation Space and tab Blank characters Control characters Printed characters Printed characters and spaces Digits, letters and underscore
\v \f \xxx \xhh
Regular Expressions String Replacement $n $2 $1 $` $' $+ $& nth non-passive group "xyz" in /^(abc(xyz))$/ "xyz" in /^(?:abc)(xyz)$/ Before matched string After matched string Last matched string Entire matched string
Regular Expressions Assertions ?= ?! ?<= ?!= or ?<! ?> ?() ?()| ?# Lookahead assertion Negative lookahead Lookbehind assertion Negative lookbehind Once-only Subexpression Condition [if then] Condition [if then else] Comment Cheat Sheet