In the following snippet function pageLoad windowonloadpageL

In the following snippet

function pageLoad(){} window.onload=pageLoad;

The assignment of the pageLoad as the event handler for window onload events lacks the open and close parentheses that would normallybe associated with pageLoad() because

a)in contast to the LISP (lots of insidious single parentheses) paradigm, this reduces the number of paratheses required

b) this is an invocation of the pageLoad function, not an assignment

c) the designers of the JavaScript language wanted to reduce the syntactic baggage associated with the statement

d) this is an invocation of the onload function not an assignment

e) this is an assignment and not an invocation of the pageLoad function

Solution

b) this is an invocation of the pageLoad function, not an assignment

The syntax window.onload=pageLoad; makes sure that the entire page and all of its related files and components are loaded before the function pageLoad() which is present in the onload event handler is executed.

In the following snippet function pageLoad(){} window.onload=pageLoad; The assignment of the pageLoad as the event handler for window onload events lacks the op

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site