The first part of the basic syntax:
1. Data type (string, Decimal, Integer, Boolean, Time date)
var s= "3.14" var n=parsefloat (s) s+=5;
var s= "abc3.14" var n=parsefloat (s)//nan s+=5;//parse convert to decimal type
var d=parseint (s)//parse converted to integer type
IsNaN (String), judging is not the number of the shape of the string, is-false; no-true
2. Variables
3, operators: four categories
4. Expressions (in order to make statements): Variable + operator
5, statement: three major categories ()
Classification:
Order
Branch: If;if. Else,if. else.. If.. Else...if. Else;if nesting
Switch...case
Circulation: Exhaustive method, iterative method, four elements (initial condition; cyclic condition; cyclic body; state change)
For ...
While ...
6, array: var a= new Array ();
7, Function: Four elements (name, input, return, processing)
Function Show ()
{
}
The second part DOM operation (manipulating HTML) tree
Windows objects--browser window
[Window.document.
Window.alert ()]
window.location--Address Bar
window.history--forward and backward (visit history)
window.status--status bar
Window.document; (emphasis)
Part III Document object:
1. Find
var D=document.getelementbyid ("ID of Element")
var d=document.getelementsbyname ("Name of Element")
var d=document.getelementsbytagnme ("tag name of element")
2. Operation element Content
Common elements: hyperlinks, pictures
Divided into 2 categories:
(1) Form element (3 Class) text (Imput:type=text,password,textarea,hidden), button (Submit/reset/button/image), selection (radio/checkbox/ Select drop-down list, list box/file)
Assignment value d.value=xxxx;
Value Var S=d.value
(2) Non-form elements: H1....h6;p;div;span;ul;ol;li (Memory News)
Control format Labels
Content container Tags:
Assignment value: d.innerhtml=xxxx;
Value: Var s=d.innerhtml;
3. Manipulating element properties
D.setattribute (name, value)
var s=d.getattribute (name)
D.removeattribute (name)
4. Operation element Style
(1) Inline style:
D.style xxxxx=xxxx;
var S=d.style.backgroudcolor;
(2) Class attribute
D.classname= ""
5. Operation related elements
Up, down, inside and outside
Web Learning Syllabus (1116/1130 for preview or review)