I'm trying to add Textarea in a table cell using JavaScript, but I'm unable to do so in Firefox and Chrome. The textarea gets added in IE but not in Firefox or Chrome, in firefox and chrome the textarea appears for flash and then disappears. One more problem is if I refresh the page in IE the text in the textarea does not go, it is present even after I refresh the page. It's a very basic JavaScript function but I am not able to debug the problem. Here is the function:-

function addRow()
alert("height : 42px; width : 496px;");
var table = document.getElementById('tableId');
var rowCount = table.rows.length;

var row = table.insertRow(rowCount);

var cell1 = row.insertCell(0);
var textNode = document.createTextNode(rowCount + 1);

var cell2 = row.insertCell(1);
//var tempLabel = document.createElement("label");
var textArea = document.createElement("textarea");
textArea.style.height = "42px";
textArea.style.width = "496px";

Are there any other best practices that I should keep in mind while doing dom manipulation.