title: How to print 5 multiplication tables per row and remaining 5 in next row using javascript?
body: <p>This is my demo.jsp page.for this code i'm getting result in single row but i need to print 5 tables per row,remaining 5  multiplication table in second row,vice-versa.where can i change the code to get expected result.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;JavaScript Tables&lt;/title&gt;
          &lt;script&gt;
              function getResult() {
                  var output;
                  var tableStart = "&lt;table&gt;";
                  var tableEnd = "&lt;/table&gt;";
                  var trStart = "&lt;tr&gt;";
                  var trEnd = "&lt;/tr&gt;";
                  var tdStart = "&lt;td&gt;";
                  var tdEnd = "&lt;/td&gt;";
                  var firstValue = document.getElementById("first").value;
                  //alert(firstValue);
                  var secondValue = document.getElementById("second").value;
                  //alert(secondValue);
                  if (firstValue &lt; secondValue) {
                      //alert(secondValue);
                      document.write(tableStart);
                      document.write(trStart);
                      for (var k = firstValue; k &lt;= secondValue; k++) {
                          document.write(tdStart);
                          document.write(tableStart);
                          document.write(trStart);
                          document.write(tdStart);
                          document.write(k + ":table");
                          document.write(tdEnd);
                          document.write(trEnd);
                          for (var i = 1; i &lt;= 10; i++) {
                              output = k * i;
                              document.write(trStart);
                              document.write(tdStart);
                              document.write(k + "*" + i + "=" + output);
                              document.write(tdEnd);
                              document.write(trEnd);
                          }
                          document.write(tableEnd);
                          document.write(tdEnd);
                      }
                      document.write(trEnd);
                      document.write(tableEnd);
                      document.close();
                  }
                  else {
                      //alert(secondValue);
                      alert("Ending table should be higher number");
                  }
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;%
              out.println("&lt;table&gt;");
              out.println("&lt;tr&gt;&lt;td&gt;Starting Number");
              out.println("&lt;/td&gt;&lt;td&gt;Ending Number&lt;/td&gt;&lt;/tr&gt;");
              out.println("&lt;tr&gt;&lt;td&gt;");
              out.println("&lt;input type='text' id='first'&gt;");
              out.println("&lt;/td&gt;&lt;td&gt;");
              out.println("&lt;input type='text' id='second'&gt;");
              out.println("&lt;/td&gt;&lt;/tr&gt;");
              out.println("&lt;tr&gt;&lt;td align='right'&gt;");
              out.println("&lt;input type='button' value='Get Tables' onclick='getResult()'");
              out.println("&lt;/td&gt;&lt;/tr&gt;");
              out.println("&lt;/table&gt;");
          %&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>