this is a code I saw on the Internet
var tTD; //Table Cell,
var table = document.getElementById(val);
for (let j = 0; j < 2; jPP) {
console.log(table.rows[0].cells[j], "jjjjj");
table.rows[0].cells[j].onmousedown = function () {
//
tTD = this;
if (event.offsetX > tTD.offsetWidth - 10) {
tTD.mouseDown = true;
tTD.oldX = event.x;
tTD.oldWidth = tTD.offsetWidth;
}
//Table
//table = tTD; while (table.tagName != "TABLE") table = table.parentElement;
//tTD.tableWidth = table.offsetWidth;
};
table.rows[0].cells[j].onmouseup = function () {
//
if (tTD == undefined) tTD = this;
tTD.mouseDown = false;
tTD.style.cursor = "default";
};
table.rows[0].cells[j].onmousemove = function () {
//
if (event.offsetX > this.offsetWidth - 10)
this.style.cursor = "col-resize";
else
this.style.cursor = "default";
//Table Cell
if (tTD == undefined) tTD = this;
//
if (tTD.mouseDown != null && tTD.mouseDown == true) {
tTD.style.cursor = "default";
if (tTD.oldWidth + (event.x - tTD.oldX) > 0)
tTD.width = tTD.oldWidth + (event.x - tTD.oldX);
//
tTD.style.width = tTD.width;
tTD.style.cursor = "col-resize";
//Cell
table = tTD; while (table.tagName != "TABLE") table = table.parentElement;
for (j = 0; j < table.rows.length; jPP) {
table.rows[j].cells[tTD.cellIndex].width = tTD.width;
}
//
//table.width = tTD.tableWidth + (tTD.offsetWidth tTD.oldWidth);
//table.style.width = table.width;
}
};
}
if this is the case, how to modify the use.