|     1.     |        When the page loads, call the   initAll()  function.       |  
  |     2.     |      function initAll() {   for (var i=0; i< document.forms[0].elements.length; i++) {      var thisElement = document.forms[0].elements[i];      if (thisElement.type == "button") {         thisElement.onclick = saySomething;      }       In the function, we loop through all the fields in the form on the page. For each field, the loop looks at the type of field. If it's a button, then we add an   onclick  handler to call the   saySomething()  function.       |  
  |     3.     |      function saySomething() {       This begins the   saySomething()  function.       |  
  |     4.     |        The value of the   this  object is used as the parameter to   switch()  . Its value will decide which of the below   case  statements gets executed.       |  
  |   |    |  
  |     5.     |      case "Lincoln":   alert("Four score and seven years ago...");   break;     If the value of the   this  object is "Lincoln", this alert appears. Regarding   break  , if the user clicked Lincoln, we're in this section of code. However, we've done everything we want to do, and so we want to get out of the   switch  . In order to do that, we need to   break  out. Otherwise, we'll execute all of the code below, too. While that continued execution can be handy in certain circumstances, this isn't one of them.       |  
  |     6.     |      case "Kennedy":   alert("Ask not what your country can do for you...");   break;       If the user clicked Kennedy, we end up in this   case  block.       |  
  |     7.     |      case "Nixon":   alert("I am not a crook!");   break;       And finally, if the user clicked Nixon, we end up here, popping up another alert and then breaking out of the   switch  .       |  
  |     8.     |        If you were wondering what would happen if the user's entry didn't meet one of the above criteria, you're in the right place. The   default  section is where we end up if our   switch  value didn't match any of the   case  values. The   default  block is optional, but it's always good coding practice to include it, just in case (so to speak). In this script, there's no code here to execute, because we shouldn't ever get here.       |  
  |     9.     |        This closing brace ends the   switch  statement.       |