Function Al () {
Alert ("I Rub")
}
At this point, Al represents the object of the function, and Al () is directly running.
var Nfun=al; Nfun also points to Al, when Nfun () is the equivalent of Al ().
So let's just say obtn.onclick.
Obtn.onclick is also equivalent to a nfun, except that it is attached to the OBTN tag.
An equal sign is an assignment that, if it is an object, points the object to the variable. Al is the object point, Al () is the function, it is finally something, just look at the function body return what type, AL in an alert, no return anything, then it is equivalent to undefined. So
obtn.onclick=undeined, you do not respond.
But if the inside of Al returns a function such as:
Function Al () {
Alert ("I do it once")
return function () {alert ("I'm Two")}
}
Obtn.onclick=al () is equivalent to
Obtn.onclick=function () {alert ("I'm Two")}
To put it bluntly, parentheses represent the execution of this method, and no parentheses represent assigning the function to a variable.
Why not write parentheses when JS plus event