Often see the plug-in inside the function call only write a function name, do not write function parameters, and even parentheses do not write, for example, said:
1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "Utf-8" />5 <title></title>6 <Scripttype= "Text/javascript">7 functionA1 () {8 Alert ('a');9 return '1';Ten }; One A - window.onload=function(){ - the //no parentheses represent all parts of the function, - alert (A1); - - Alert ('A1 End'); + - //the parentheses represent the part of the function body. + alert (A1 ()); A } at - - </Script> - </Head> - <Body> - </Body> in </HTML>
The results shown above are as follows:
Can be seen,
1. write only the function name is equivalent to taking all parts of the function, including the declaration:
Example: BTN.ONCLICK=A1
Equivalent to
Btn.onclick=function A1 () {
Alert (' a ');
Return ' 1 ';
}
2. Writing the function brackets represents the calling function, similar to a function call in Java.
The difference between the parentheses and the name of the write function when JS calls the function the difference between FN and FN ()