js生成九九乘法表

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    document.write("<table width='800' border='0'>");
    for( var j = 1; j <= 9 ; j++){
        document.write("<tr>");
        for(var i = 1; i <= j ; i++){
            document.write("<td>");
            document.write( i+"*"+j+"="+i*j);
            document.write("</td>");
        }
        document.write("</tr>");
    }
    document.write("</table>");
    ///
    var i = 100;
    var sum = 0;
   while( i <= 200 ){
        if( i%10 ==3){
            i++;
            continue;
        }
        sum += i;
        i++;
    }
    console.log(sum);    document.write("<table width='800' border='0'>");
    for( var j = 1; j <= 9 ; j++){
        document.write("<tr>");
        for(var i = 1; i <= j ; i++){
            document.write("<td>");
            document.write( i+"*"+j+"="+i*j);
            document.write("</td>");
        }
        document.write("</tr>");
    }
    document.write("</table>");
    ///
    var i = 100;
    var sum = 0;
   while( i <= 200 ){
        if( i%10 ==3){
            i++;
            continue;
        }
        sum += i;
        i++;
    }
    console.log(sum);
</script>

</body>
</html>

猜你喜欢

转载自www.cnblogs.com/Ironman725/p/10982547.html
今日推荐