问答详情
源自:3-7 二维数组

为什么显示不出来啊?

为什么在浏览器里不显示结果?

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>二维数组</title>

<script type="text/javascript">

var myarr=new Array();

for(var i=0;i<3;i++){

    myarr[i]=new Array();

    for(var j=0;j<6;j++){

        myarr[i][j]=i*j;

    }

}

document.write(myarr[i][j]);

</script>

</head>


<body>

</body>

</html>


提问者:下雨不停的雨婷 2016-07-15 10:37

个回答

  • 慕村9071095
    2016-07-15 10:45:03
    已采纳

    <!DOCTYPE HTML>

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <title>二维数组</title>

    <script type="text/javascript">

    var myarr=new Array();

    for(var i=0;i<3;i++){

        myarr[i]=new Array();

        for(var j=0;j<6;j++){

            myarr[i][j]=i*j;
    document.write(myarr[i][j]);

        }

    }


    </script>

    </head>


    <body>

    </body>

    </html>


  • Alivegirl
    2016-07-15 10:46:53

    document.write(myarr[i][j]);放在  myarr[i][j]=i*j;下面

  • Alivegirl
    2016-07-15 10:45:37

    document.write(myarr[i][j]);放在document.write(myarr[i][j]);下面