Skip to content

Instantly share code, notes, and snippets.

@StoneCypher
Created October 3, 2014 06:29
Show Gist options
  • Select an option

  • Save StoneCypher/b1d3871bdac0fe3e9d11 to your computer and use it in GitHub Desktop.

Select an option

Save StoneCypher/b1d3871bdac0fe3e9d11 to your computer and use it in GitHub Desktop.
function makeBoard(host, subx, suby) {
var i,j,
sz = subx * suby;
for (j=0; j<sz; ++j) {
var div = document.createElement('div');
for (i=0; i<sz; ++i) {
var inp = document.createElement('input');
inp.id = 'input_' + x.toString() + '_' + y.toString();
var cellClass;
if ((i % subx) === 0) { cellClass = 'leftHeavy'; }
if ((j % suby) === 0) { cellClass = 'topHeavy'; }
inp.className = cellClass;
div.appendChild(inp);
}
host.appendChild(div);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment