JavaScript Cheat Sheet – Quick Reference

Methods

DOM Methods

Object Range
toString
toLocaleString
valueOf
hasOwnProperty
isPrototypeOf
propertyIsEnumerable
collapse
createContextualFragment
moveEnd
moveStart
parentElement
select
setStartBefore
String Node
charAt
charCodeAt
fromCharCode
concat
indexOf
lastIndexOf
localeCompare
match
replace
search
slice
split
substring
substr
toLowerCase
toUpperCase
toLocaleLowerCase
toLocaleUpperCase
addEventListener
appendChild
attachEvent
cloneNode
createTextRange
detachEvent
dispatchEvent
fireEvent
getAttributeNS
getAttributeNode
hasChildNodes
hasAttribute
hasAttributes
insertBefore
removeChild
removeEventListener
replaceChild
scrollIntoView
RegEx Style
test
match
exec
getPropertyValue
setProperty
Array Document
concat
join
push
pop
reverse
shift
slice
sort
splice
unshift
clear
createDocument
createDocumentFragment
createElement
createEvent
createEventObject
createRange
createTextNode
getElementsByTagName
getElementById
write
Number Event
toFixed
toExponential
toPrecision
initEvent
preventDefault
stopPropagation
Date Form
parse
toDateString
toTimeString
getDate
getDay
getFullYear
getHours
getMilliseconds
getMinutes
getMonth
getSeconds
getTime
getTimezoneOffset
getYear
setDate
setHours
setMilliseconds
setMinutes
setMonth
setSeconds
setYear
toLocaleTimeString
submit
DOM Collections
item
XMLSerializer
serializeToString
XMLHTTP
open
send
XMLDOM
loadXML
DOMParser
parseFromString

Functions

Window Built In
alert
blur
clearTimeout
close
focus
open
print
setTimeout
eval
parseInt
parseFloat
isNaN
isFinite
decodeURI
decodeURIComponent
encodeURI
encodeURIComponent
escape
unescape

XMLHttpRequest

XMLHttpRequest Object Methods

Safari, Mozilla, Opera:
var req = new XMLHttpRequest();
Internet Explorer:
var req = new
ActiveXObject(“Microsoft.XMLHTTP”);
abort()
getAllResponseHeaders()
getResponseHeader(header)
open(method, URL)
send(body)
setRequestHeader(header,

XMLHttpRequest Object Properties

XMLHttpRequest readyState Values

onreadystatechange
readyState
responseText
responseXML
status
statusText
0 – Uninitiated

1 –  Loading

2 – Loaded

3 – Interactive

4 – Complete

JAVASCRIPT IN HTML

REGULAR EXPRESSIONS – FORMAT

External JavaScript File
<script type=”text/javascript”
src=”javascript.js”></script>
Inline JavaScript
<script type=”text/javascript”>
<!–
// JavaScript Here
//–>
</script>
Regular expressions in JavaScript take
the form:
var RegEx = /pattern/modifiers;

REGULAR EXPRESSIONS – MODIFIERS

REGULAR EXPRESSIONS – PATTERNS

/g – Global matching
/I – Case insensitive
/s – Single line mode
/m – Multi line mode
^ – Start of string
$ – End of string
. – Any single character (dot)
(a|b) – a or b
(…) – Group section
[abc] – Item in range (a or b or c)
[^abc]- Not in range (not a or b or c)
a? – Zero or one of a
a* – Zero or more of a
a+ – One or more of a
a{3} – Exactly 3 of a
a{3,} –  or more of a
a{3,6} – Between 3 and 6 of a
!(pattern) –  “Not” prefix. Apply rule when
URL does not match pattern.

EVENT HANDLERS

FUNCTIONS AND METHODS

onAbort – onMouseDown
onBlur – onMouseMove
onChange – onMouseOut
onClick – onMouseOver
onDblClick – onMouseUp
onDragDrop – onMove
onError – onReset
onFocus – onResize
onKeyDown – onSelect
onKeyPress – onSubmit
onKeyUp – onUnload
onLoad
A method is a type of function, associated
with an object. A normal function is not
associated with an object.

About onlinejt

Blogger

No comments yet.

Leave a Reply

*