Assignment Operators x=x%y x%=y %= x=x/y x/=y /= x=x*y x*=y *= x=x-y x-=y -= x=x+y x+=y += x=y x=y = Is The Same As Example Operator
Comparison Operators is less than or equal to <= is greater than or equal to >= is less than < is greater than > is not equal != is equal to (checks for both value and type) === is equal to == Description Operator
Flow control
If then else
Switch
For loop
While loop
Break/continue statement
Arrays
Creating an array
var mycars=new Array() ;
var mycars=new Array(3) ;
var mycars=new Array("Saab","Volvo","BMW") ;
Accessing value in array
alert( mycars[0] );
Dynamic length
Flexible data type
Basic Function
alert(“some text”);
confirm(“some text”);
Return true/false
prompt(“some text”,”default value”);
Return user’s inputted value
Java Script Object Contains information about the current URL Location Contains the visited URLs in the browser window History Contains information about the client's display screen Screen Contains information about the client's browser Navigator The top level object in the JavaScript hierarchy. The Window object represents a browser window. A Window object is created automatically with every instance of a <body> or <frameset> tag Window Description Object
Events
Examples of events :
A mouse click
A web page or an image loading
Mousing over a hot spot on the web page
Selecting an input box in an HTML form
Submitting an HTML form
A keystroke
HTML Event
onload and onUnload
onFocus, onBlur and onChange
onSubmit
onMouseOver and onMouseOut
And etc.
Invoking Java Script function
<input type =" text " size =" 30 " id =" email " onchange =" checkEmail ()" >
HTML DOM The DOM (Document Object Model) presents an HTML document as a tree - structure ( a node tree ) , with elements, attributes, and text .
DOM Inspector
Access Node
Get element by ID
document.getElementById('someID')
Get element by tag name
document.getElementsByTagName("p")
Return value possible to be either object or array of object
0 comments
Post a comment