js輸入行和列生成表格 JS繪制表格?
JS繪制表格?通過(guò)動(dòng)態(tài)創(chuàng)建表來(lái)創(chuàng)建表,TR,TD函數(shù)autocreate(){//Create table var table=文檔.createElement(“表”)表.setAttribute(
JS繪制表格?
通過(guò)動(dòng)態(tài)創(chuàng)建表來(lái)創(chuàng)建表,TR,TD函數(shù)autocreate(){//Create table var table=文檔.createElement(“表”)表.setAttribute(“border”,“1”)表.setAttribute(“background”,“red”)//獲取行值var line=文檔.getElementById(“行”)。Value//獲取列值var list=文檔.getElementById(“列表”)。Valuefor(VaR I=1I<=lineI){//Alert(line)//創(chuàng)建trvar tr=文檔.createElement(“tr”)for(VaR J=1J<=listj){//警報(bào)(列表)//創(chuàng)建tdvar TD=文檔.createElement(“td”)td.innerHTML=我* jtr.1子級(jí)(td)}表.appendChild(tr)}文檔.getElementById(“d1”).appendChild(表)}