This is Example 5.1 of JavaScript an Interactive Course.

It is somewhat deceptive in that if the page includes any document.write( )'s then the function or script in onLoad executes after all the document.write( )'s.

In particular, the name requested in hello( ) is unavailable inside the script in the body.

Also notice that the message in bye( ) does not appear until you leave this page -e.g. with the Back button or with Reload.


Wow!