This is untested psuedo-code, but may help you get started:
var x, row;
for(x=1;x<10;x=x+row)
{
document.write('<tr>');
for(row=0;row<2;row++)
{
document.write('<td>' + (x + row));
// Whatever else you want to output
}
}
Edit: this answer was given before OP edited his question to add additional info.