title: How to call a JavaScript function within an HTML body
body: <p>I have a JavaScript function that fills a table:</p>
  
  <pre><code>&lt;script&gt;
  
  var col1 = ["Full time student checking (Age 22 and under) ", "Customers over age 65", "Below  $500.00"];
  var col2 = ["None", "None", "$8.00"];
  
  function createtable() {
      &lt;!--To fill the table with javascript--&gt;
      for (var j = 0; j &lt; col1.length; j++) {
          if (j % 2 == 0) {
              document.write("&lt;tr&gt;&lt;td&gt;" + col1[j] + " &lt;/td&gt;");
              document.write("&lt;td&gt;" + col2[j] + "&lt;/td&gt;&lt;/tr&gt;");
          } else {
              document.write("&lt;tr  bgcolor='#aeb2bf'&gt;&lt;td&gt;" + col1[j] + " &lt;/td&gt;");
              document.write("&lt;td&gt;" + col2[j] + "&lt;/td&gt;&lt;/tr1&gt;");
          }
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to execute it within the HTML body. I have tried the following, but it doesn't create the table.</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Balance&lt;/th&gt;
          &lt;th&gt;Fee&lt;/th&gt;        
      &lt;/tr&gt;
        createtable();
  &lt;/table&gt;
  </code></pre>
  
  <p>How I can execute this function within the HTML body?</p>