I have made a function in JavaScript which automatically adds a line to a table every minute. It works fine, except that I would like to delete the second line of the table (since the first line is used for headings) if there are more than 5 lines. I tried this code:
if(table.getElementsByTagName("tr").length > 5){
table.getElementsByTagName("tr")[1].outerHTML = "";
}
The problem is that when executing the second line, I get an error message saying "unknown execution error". Why does it do that? Is there any way to get around it?
In case it's important, I'm using HTA.
1). What browser gives this error? What is HTA? You should provide a full working demonstration of the issue.<thead>element and the rest in a<tbody>. Then you can simply dotable.tBodies[0].rows[0]to get the row you want.table.deleteRow(1);