私は研究をした後にヒントを得ていないので、私は尋ねるポイントになった。javascriptの出力[オブジェクトのHTMLCollection]
So次のコードでは、divのより正確な配列の内部を単純なブロックとして出力することになっています。 何らかの理由で、すべての "B01"が[object HTMLCollection]として出力され、代わりにCSSで定義されたブロックとして出力されます。 これはどうやって起こりますか?どのように修正できますか?
var B01 = document.getElementsByClassName("block_matrix");
var level = [B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
\t \t \t B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01];
\t \t \t
\t \t document.write(level);
\t \t
body, html{
\t margin:0;
\t border:0;
\t width:100%;
\t height:100%;
\t background-color: grey;
}
#game{
\t width:90%;
\t height: 90%;
\t margin: 0 auto;
}
.block_matrix{
\t width:5%;
\t height:5%;
\t background-color:orange;
\t z-index:1;
\t position:absolute;
}
<!DOCTYPE HTML>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="script/main.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="gfx/style.css" media="screen" />
</head>
<body>
<div id="game">
<script>
</script>
</div>
<div class="block_matrix">
</div>
</body>
</HTML>
'document.write()'が何をすることを期待しているのかはっきりしません – Pointy