Every script must be identified as such -- begin your code:
<script language="JavaScript">
Add your variables:
var ro = "<tr>";


If you want to keep the script in a form for easy editing, you should break it down into arguments to write small sections at a time. That requires many
document.write("your table codes");

To cut down on the number of characters needed, do this:
Immediately after listing your variables start a loop with this
with(document){
and remember to close the loop with the curly bracket, }.

In between the brackets is where you put the arguments to "write" your codes. Since you told the browsers that everything begins with document , all you need to include is
write("your codes");
for each step.



OK, here we go with a working script. I will add comments to explain what the different parts mean:
<script language="JavaScript">
var a="<td width=2 height=1></td>";

// var a repeated 9 times will make 9 cells
var aa = a+a+a+a+a+a+a+a+a;
//var aa repeated 9 times will make 81 cells (9 X 9)
var aaa = aa+aa+aa+aa+aa+aa+aa+aa+aa;
var ro = "<tr>";
var rch = "</tr>";
var rcl = "";
var tcl= "";
var dop = "";
var dch="";
var tab=" var wd=" width=";
//let's add some colors
var c1="333333";
var c2="cccccc";
var c3="887300";
var c4="ffd700";

//a spacer colspan=4
var sp=dop+"4"+dcl;
//let's start making some tables
//open with this
with(document){
//open table, open row, make 81 empty cells, change row
write("<center>"+tab+">"+ro+aaa+rch);
//now we have 81 cells centered on screen
/*let's make a roof for a building --
NOTE each line has a total rowspan of 81*/
write(dop+"40"+dh+"10"+dcl+dop+"1"+dbg+c1+dcl+dop+"40"+dcl+rch);
/* Row above == open cell #1 colspan=40 height=10, cell #2 rowspan=1 color 333333, cell #3 colspan=40, change rows.
Each successive row writes a little larger cell with bgcolor and smaller empty cells on the sides.
NOTE -- height can be defined in any cell of a row and only needs to be included in one cell. If included in more than one, the larger number will override all others.*/
write(dop+"39"+dh+"8"+dcl+dop+"3"+dbg+c1+dcl+dop+"39"+dcl+rch);
write(dop+"37"+dh+"6"+dcl+dop+"7"+dbg+c1+dcl+dop+"37"+dcl+rch);
write(dop+"34"+dh+"4"+dcl+dop+"13"+dbg+c1+dcl+dop+"34"+dcl+rch);
write(dop+"30"+dh+"2"+dcl+dop+"21"+dbg+c1+dcl+dop+"30"+dcl+rch);
write(dop+"25"+dh+"2"+dcl+dop+"31"+dbg+c1+dcl+dop+"25"+dcl+rch);
write(dop+"19"+dh+"2"+dcl+dop+"43"+dbg+c1+dcl+dop+"19"+dcl+rch);
write(dop+"12"+dh+"2"+dcl+dop+"57"+dbg+c1+dcl+dop+"12"+dcl+rch);
write(dop+"4"+dh+"2"+dcl+dop+"73"+dbg+c1+dcl+dop+"4"+dcl+rch);
write(dop+"81"+dbg+c1+dcl+rch);