Comme je n'en ai aucune idée après avoir fait des recherches, j'en suis venu à demander.
Le code suivant est censé afficher l'intérieur du tableau comme des divs, plus précisément comme un simple bloc. Pour une raison quelconque, chaque "B01" sera affiché comme [object HTMLCollection], au lieu d'être un bloc comme défini dans la CSS. Comment cela se produit-il et comment puis-je le corriger ?
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,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01,
B01, B01, B01,B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01, B01 , B01];
document.write(level);
body, html{
margin:0;
border:0;
width:100%;
height:100%;
background-color: grey;
}
#game{
width:90%;
height: 90%;
margin: 0 auto;
}
.block_matrix{
width:5%;
height:5%;
background-color:orange;
z-index:1;
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>