js打印顺序和倒序乘法口诀

来源:互联网 发布:西安金象网络 编辑:程序博客网 时间:2024/06/09 17:31
<!doctype html><html lang="en"> <head>  <meta charset="UTF-8">  <meta name="Generator" content="EditPlus®">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content="">  <title>9*9乘法表</title> </head> <body>  <script>function cheng(){//顺序var row=9,//行            i=1,  //初始化循环值col=9;//列        for(i;i<=row;i++){    for(var j=1;j<=i;j++){   document.write(j+"*"+i+"="+i*j+" ");}document.write("</br>");}document.write("<hr>");}function reverseCheng(){//倒叙 从9*9开始    var row=9,//初始化行            i=1,col=9;//列for(row;row>=i;row--){   for(var j=row;j<=row&&j>0;j--){      document.write(j+"*"+row+"="+row*j+" ");   }   document.write("</br>");}document.write("<hr>");}function reverseCheng2(){ //倒叙 1*9开始    var row=9,//初始化行            i=1,//行col=9;//列for(row;row>=i;row--){   for(var j=1;j<=row;j++){      document.write(j+"*"+row+"="+row*j+" ");   }   document.write("</br>");}       document.write("<hr>");}window.onload=function(){  cheng();  reverseCheng2();  reverseCheng();}  </script> </body></html>

0 0
原创粉丝点击