Actually. I found my answer. I had read Chapter 2, but it didn't stick. I carefully read again and now it more clear. Just for reference for anyone else just beginning, and to lock it in my own brain, here are the simplified steps, based on the html and script in CH2.
HTML page. At bottom
<script src="js/login.js"></script>. This executes the login.js script.
At bottom of login.js is --> window.onload = init; This tells us which function to execute when it loads the script.
in function init()--> We create a listener var loginForm = document.getElementById('loginForm');
loginForm.onsubmit = validateForm;
The validateForm() function does the validate form which returns true if everything is good, if not, it returns false.
If the script returns true, then
<form action="login.php" method="post" id="loginForm"> actually executes.
A key piece of information that I picked up from page 45 is this
To start, note that the only thing different about this form and one that wouldn't be tied to JavaScript is that each element has both a name attribute and an id attribute. The name value will be used when the form data is submitted to the server-side PHP script. The id value will be used by the JavaScript.
I also learned an understood that JavaScript is an event language. So an event listener will happen before the call to action="somescript.php".