拿走,不谢
var row = 3; var column = 6; var myarr = new Array(); for(var i=0; i<row; i++){ myarr[i] = new Array(); for(var j=0; j<column; j++){ myarr[i][j] = i*j; } } for(i=0; i<row; i++){ for(j=0; j<column; j++){ document.write("<span style='background-color:#ccc;border:1px solid black; margin:1px; padding:10px; display:inline-block; width:20px; height:20px; text-align:center; line-height:20px;'>"+myarr[i][j]+"</span>"); } document.write("<br/>"); }