If you are looking to preserve the overall width of the table, you can check it prior to hiding a row, and explicitly set the width style property to this value:
table.style.width = table.clientWidth + "px";
table.rows[3].style.display = "none";
However, this may cause the individual columns to reflow when you hide the row. A possible way to mitigate this is by adding a style to your table:
table {
table-layout: fixed;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…