Hello Blog Garden- multiplication table

Hello world,Hello Blog Garden 

        First to introduce myself, just graduated from a junior novice programmer, currently engaged in front-end development work, choose to blog Park, on the one hand want to learn and grow, on the other hand want to share out of their own upbringing. Learn programming language really hard for me, a college entrance examination in English 35 points, but master, round trip. I hope that reading this many years later, when his face bare smile, then I hope to be successful themselves.

  Primary school mathematics is the multiplication table from the beginning, now I'm by the multiplication table to start my blog park career. The first to write the multiplication table for the cycle by a double when I found not a newline looks nothing like the multiplication table, then I print out a more beautiful effect by printing the form on the page, forming rows and columns . code show as below:

< Script > 
  // use document.write () when the page is printed will overwrite the previous contents of other content pages 
        document.write ( " <Table> " );
         for ( var I =  . 1 ; I <  10 ; I ++ ) { 
            document.write ( " <TR> " );
             for ( var J =  . 1 ; J <= I; J ++ ) { 
                document.write ( " <TD> " ); 
                Document.write(i + "*" + j + "=" + i * j);             
                document.write("</td>");
            }
            document.write("</tr>")
        }
        document.write("</table>")
 </script>

 

Results are as follows (page screenshot)
  Course also be used <br/> linefeed embodiment, but the drawback is unsightly appearance in order to make the point I select Add & nbsp; & nbsp; so as to increase the space, but not recommended & nbsp; advantage is that less code
<script>
        for (var i = 1; i < 10; i++) {
            for (var j = 1; j <= i; j++) {
                document.write(i + "*" + j + "=" + i * j);
                document.write("&nbsp;&nbsp;&nbsp;");
            }
            document.write("<br/>");
        }
</script>
Results are as follows (page screenshot)
Advanced rookie road, welcome criticism and education           2019-09-21 17:11:08

Guess you like

Origin www.cnblogs.com/zhzq1111/p/11563765.html