title: I have to make a webpage that can run some simple JavaScript, but I don't think my script is running
body: <p>Here's the full code, along with the script. When I open the html file, the page looks the way I want it to look, but when I enter a value and click the submit button, nothing happens. Is there something wrong in the script, or is it some simple error I missed?</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
      &lt;html&gt;
  
  &lt;head&gt;
  
  &lt;title&gt;Question 10.10&lt;/title&gt;
  
  &lt;style type="text/css"&gt; 
  table, table td   { padding: 5px }
  &lt;/style&gt;
  
  &lt;script type="text/javascript&gt;"&gt;
          // initialize 4 rows 5 columns sales array
          var counters = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
  
          // function to collect and process sales slips
          function submitSales()
          {   
              var salary = 0; // current calculated salary
  
              // Get values from XHTML form fields
              var grossSales = parseInt( document.getElementById( "grossField" ).value );
  
              // Validate user input gross
              if ( isNaN( grossSales ) )
              {
                  // Alert user to the error
                  window.alert( "Invalid gross entered!" );
                  return;
              } // End while
  
              // Calculate salary
              salary = 200 + parseInt( ( .09 * grossSales ) );
  
              // Increment the counter for the salary range
              if ( salary &gt;= 200 &amp;&amp; salary &lt;= 299 )
                  ++counters[ 0 ];
              if ( salary &gt;= 300 &amp;&amp; salary &lt;= 399 )
                  ++counters[ 1 ];
              if ( salary &gt;= 400 &amp;&amp; salary &lt;= 499 )
                  ++counters[ 2 ];
              if ( salary &gt;= 500 &amp;&amp; salary &lt;= 599 )
                  ++counters[ 3 ];
              if ( salary &gt;= 600 &amp;&amp; salary &lt;= 699 )
                  ++counters[ 4 ];
              if ( salary &gt;= 700 &amp;&amp; salary &lt;= 799 )
                  ++counters[ 5 ];
              if ( salary &gt;= 800 &amp;&amp; salary &lt;= 899 )
                  ++counters[ 6 ];
              if ( salary &gt;= 900 &amp;&amp; salary &lt;= 999 )
                  ++counters[ 7 ];
              if ( salary &gt;= 1000 )
                  ++counters[ 8 ];
  
              // output the results
              displayResults();
  
              // Reset fields in XHTML form
              document.getElementById( "grossField" ).value = "0";
  
          } // end function submitSales
  
          // function to generate and display the weekly report
          function displayResults()
          {   
              var printoutTable = "&lt;table border = \"1\"&gt;"; // this will hold the table to be output
              printoutTable += "&lt;tr&gt;&lt;td colspan = \"2\" style = \"text-align: center\"&gt;&lt;h1&gt;Weekly Salary Range Report&lt;/h1&gt;&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;Range&lt;/td&gt;&lt;td&gt;Number of Employees&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$200-299&lt;/td&gt;&lt;td&gt;" + counters[ 0 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$300-399&lt;/td&gt;&lt;td&gt;" + counters[ 1 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$400-499&lt;/td&gt;&lt;td&gt;" + counters[ 2 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$500-599&lt;/td&gt;&lt;td&gt;" + counters[ 3 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$600-699&lt;/td&gt;&lt;td&gt;" + counters[ 4 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$700-799&lt;/td&gt;&lt;td&gt;" + counters[ 5 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$800-899&lt;/td&gt;&lt;td&gt;" + counters[ 6 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$900-999&lt;/td&gt;&lt;td&gt;" + counters[ 7 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;tr&gt;&lt;td&gt;$1000+&lt;/td&gt;&lt;td&gt;" + counters[ 8 ] + "&lt;/td&gt;&lt;/tr&gt;";
              printoutTable += "&lt;/table&gt;";
  
              // send the XHTML code to the div to display the table
              document.getElementById( "salesPrintout" ).innerHTML = printoutTable;
  
          } 
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  
  
  &lt;body&gt;
  
  &lt;form action=""&gt;
  
  &lt;h1&gt;Employee Sales&lt;/h1&gt;
  &lt;td&gt;Gross Sales: $&lt;/td&gt;
  
  &lt;td&gt;
  &lt;input id="grossfeild" type="text"&gt;&lt;/input&gt;
  &lt;/td&gt;
  
  &lt;input type="button" onclick="submitSales()" Value="Submit"&gt;&lt;/input&gt;
  
  &lt;div id="salesPrintout"&gt;
  
      &lt;table borders="1"&gt;
  
      &lt;h1&gt;Weekly Sales Report&lt;/h1&gt;
      &lt;tr&gt;
      &lt;td&gt;Range&lt;/td&gt;
      &lt;td&gt;Number of Employees&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
      &lt;td&gt;$200-299&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$300-399&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$400-499&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$500-599&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$600-699&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$700-799&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$800-899&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$900-999&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;$1000+&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;/tr&gt;
  
  
  
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>