テキストのコードを丸々写したのですがプレビューが表示されません。
何度も見返したのですが原因が分からないため、見ていただきたいです。
HTML
1<!DOCTYPE html> 2<html lang="ja"> 3 <head> 4 <meta charset="utf-8"> 5 <title>ドット絵作成ツール テスト</title> 6 7 <style> 8 table { border-collapse: collapse; } 9 td { 10 width: 30px; 11 height: 30px; 12 border: solid 1px; 13 } 14 </style> 15 </head> 16 <body> 17 <div> 18 <table id="dotTBL"></table> 19 <br> 20 <table id="ColorTBL"><tr></tr></table> 21 </div> 22 23 <script> 24 var Matrix_Rows = 16; 25 var Matrix_Cols = 16; 26 var Color_Index = "black"; 27 28 var dotTbl = document.getElementById("dotTBL"); 29 var ColTbl = document.getElementById("ColorTBL"); 30 31 function dotTable() { 32 for(var i=0; i<Matrix_Rows; i++) { 33 var row = dotTbl.insertRow(-1); //行を追加 34 for(var j=0; j<Matrix_Cols; j++) { 35 var cell = row.insertCell(-1); //行にセルを追加 36 } 37 } 38 } 39 40 //選べる色を配列で定義 41 var COL_SAMPLE = ["black", "gray", "whte", "red", "orange", "yellow", "lime", "cyan", "blue", "magenta"]; 42 43 //色を選ぶテーブル 44 function colorTable() { 45 for(var j=0, j<COL_SAMPLE.length; j++){ 46 var cell = colTbl.rows[0].insertCell(-1); 47 cell.style.backgroundColor = COL_SAMPLE[j]; 48 } 49 } 50 51 window.onload = function() { 52 dotTable(); 53 colorTable(); 54 } 55 </script> 56 </body> 57</html>
回答2件
あなたの回答
tips
プレビュー