Java script Examples


Elements Reference

getElementById
getElementsByTagName
getElementsByName
getElementsByClassName

Dropdown

create-dropdown
get-selected-item
preselect-dropdown

Element Insertion

insertAdjacentHTML

Node Manipulation

childNodes-firstChild-lastChild
nodeName
sibling&nodeType
cloneNode
isSameNode
isEqualNode
nodeType
nodeName
nodeValue
nodeValue

Styles Manipulation

cssRules
create style
insert & delete rule
removeProperty
cssText
getPropertyValue
setProperty
getComputedStyle

Width & Height

offsetHeight-clientHeight-scrollHeight

Events

target
type
Add/Remove Events
stopPropogation
preventDefault

Mouse Cordinates

clientX & clientY
screenX & screenY
pageX & pageY
offsetX & offsetY
altKey
ctrlKey

TextBox

charCode
select
selectionStart & selectionEnd
setSelectionRange
accept only numbers

Forms

submit & reset
form elements

Arrays

push
pop
splice
slice
shift
unshift
unshift
sort by descending
reverse
map
every
filter
findindex
find
foreach

Strings

anchor
big
blink
bold
charAt
charCodeAt
concat
constructor
fixed
fontcolor
fontsize
italics
indexOf
lastIndexOf
length
link
match
replace
search
slice
small
split
substr
substring
toUpperCase
toLowerCase
toString
trim

Integer Datatype

parseInt function
ocatal & hexadecimal
Number function
NaN
isNaN function
typeof operator

Float Datatype

Exponential notation

Boolean Datatype

Boolean function

Date Object

Date()
getDate()
getDay()
getFullYear()
getHours()
getMilliseconds()
getMinutes()
getMonth()
getSeconds()
getTime()
predefined date
toDateString()
toLocaleDateString()
toGMTString()

HTML Table

createCaption()
createTHead()
createTBody()
insertRow() & insertCell()

Validation

Basic