I use the below code to add or remove a row from a table using javascript. The code works fine on IE however it doesnt work on Firefox, can anybody suggest reasons why this might be doing so?
The id "table1" is the ID of the table I am trying to insert the innerhtml into.
Any help would be greatly appreciated.
Thanks
function addRoom()
{
var row = document.all("table1").insertRow();
var column = row.insertCell();
column.innerHTML = "input type='text' name=txt1>";
column = row.insertCell();
column.innerHTML = "input type='text' name=txt2>";
column = row.insertCell();
column.innerHTML = "<input type='button' value='Delete' onClick='remove(this);' />";
}
function remove(src)
{
var rowd = src.parentElement.parentElement;
document.all("table").deleteRow(rowd.rowIndex);
}