Home >Web Front-end >JS Tutorial >Implementing ninety-nine multiplication tables based on javascript_javascript skills

Implementing ninety-nine multiplication tables based on javascript_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 15:08:051220browse

The example in this article shares with you the relevant code for implementing the ninety-nine multiplication table in JavaScript. The specific content is as follows

<script type="text/javascript">
    var sum=0;
    var wite;
    for (var i = 1; i < 10; i++){
      var div=$('<div class="class'+i+'"></div>');
      $("body").append(div);
      for(var j = i; j > 0; j--){
        sum = j * i;
        wite = (j+"X"+i+"="+sum);

        div.prepend($('<span style="padding-right:10px">'+wite+'</span>'));
      }
      
    } 
  </script>

The implementation result is shown in the figure:

I hope this article will be helpful to everyone learning JavaScript programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn