Tag: Is the set htm utf-8 turn fine col parameter btn
The JS parsing process is divided into two stages: the compile stage and the execution stage. The Declaration and definition of function functions are advanced in the compilation phase, and the declaration of VAR is advanced, and the variable defined by VAR is assigned a value of undefined.
Anonymous functions:
Window.onload = function () { var oBtn01 = document.getElementById (' Btn01 '); var oBtn02 = document.getElementById (' btn02 '); Note that there can be no parentheses, Skin01 () immediately executed oh, so do not add ()! Obtn01.onclick = Skin01; Obtn02.onclick = skin02; }
This is an anonymous function, without a name ~
function arguments (similar to Python ~):
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Title</title> <Scripttype= "Text/javascript">window.onload= function () { varOdiv=document.getElementById ('Div1'); Changestyle ('Color','Gold'); Changestyle ('background','Hotpink'); Changestyle ('width','300px'); Changestyle ('Height','300px'); Changestyle ('margin','50px Auto'); functionChangestyle (styl,val) {Odiv.style[styl]=Val; } } </Script></Head><Body><DivID= "Div1">div element</Div></Body></HTML>
Function parameters:
Window.onload = function () { var oBtn01 = document.getElementById (' Btn01 '); var oBtn02 = document.getElementById (' Btn02 ');//Note there can be no parentheses, Skin01 () immediately executes the oh, so do not add ()! Obtn01.onclick = Skin01;obtn02.onclick = skin02;}
return keyword effect:
1) return function execution result;
2) End Function operation;
3) block default behavior.
js--of variables and functions, anonymous functions, function arguments, return