这里你去:
td{min-width:100px;min-height:20px;border:solid 1px #000;}
window.onload = function() {
document.getElementById('btnCreate').addEventListener('click', function(){
var rows = parseInt(document.getElementById('txtRows').value),
cols = parseInt(document.getElementById('txtCols').value);
create(rows,cols);
});
}
function create(rows, cols) {
if (rows <= 0 || cols <= 0)
return false;
var html = '
for (i=0;i
html += '
';for (j=0;j
html += '
';}
html += '
';}
html += '
';document.getElementsByTagName('body')[0].innerHTML = html;
}
rows:
cols:
希望有所帮助。