function MyTable(rows,cols){
this.createTable = function(){
this.table = document.createElement('table');
this.table.style.border = '2px solid red';
for(var i=0;i
tr = this.table.insertRow();
for(var j=0;j
var td = tr.insertCell();
td.style.lineHeight = '50px';
td.style.width = '70px';
td.style.textAlign = 'center';
td.innerHTML =i*j;
}
}
}
this.createTable();
this.addIn = function(ele){
ele.appendChild(this.table)
}
}
var tb = new MyTable(9,9);
tb.addIn(document.body)
function createTable(){
var table = document.createElement('table');
table.style.border = '1px solid gray';
for(var i=1;i<10;i++){
var tr = table.insertRow();
for(var j=1;j
var td = tr.insertCell();
td.innerHTML =i+'*'+j+'='+i*j;
td.style.lineHeight = '50px';
td.style.backgroundColor = 'orange'
}
}
document.body.appendChild(table)
}
createTable()
一键复制
编辑
Web IDE
原始数据
按行查看
历史