用js 向h5 中的table 动态添加数据 (简单实现)

时间:2022-04-06 04:13:29

//向 表格传值
function setTextareaValue(items,pp){
console.log(" 进入函数 items=="+items);
var tb = document.getElementById("addtable");
var td1 = tb.rows[1].cells[1];
var td2 = tb.rows[1].cells[2];
var td3 = tb.rows[1].cells[3];
var td4 = tb.rows[1].cells[4];
var td5 = tb.rows[1].cells[5];
var td6 = tb.rows[1].cells[6];

td1.innerHTML = items.province;
td2.innerHTML = items.city;
td3.innerHTML = items.district;
td4.innerHTML = items.street+items.streetNumber;
td5.innerHTML = pp.lng;
td6.innerHTML = pp.lat;

}