Hi,
I have some JS that creates a table
The trouhle is, is that it doesn't seem to allocate an id for the object with my script above. Where I go
I get a message box with 'null'
however, using
does not return null, as content is the id of a div I have in teh HTML itself.
The same problem occurs in IE and FF, does anyone know a solution to this problem?
Thanks!
I have some JS that creates a table
Code:
var docBody = document.getElementsByTagName("body").item(0);
docBody.appendChild(advancedSearchTable);
var advancedSearchTable = document.createElement("table");
// Create a table row
var row = advancedSearchTable.insertRow(advancedSearchTable.rows.length);
// This cell will hold the label
var label = row.insertCell(0);
// Style the label
label.id = 'fooCell'
label.innerHTML = "foo";
The trouhle is, is that it doesn't seem to allocate an id for the object with my script above. Where I go
Code:
alert(document.getElementById(label.id);
I get a message box with 'null'
however, using
Code:
alert(document.getElementById('content'));
does not return null, as content is the id of a div I have in teh HTML itself.
The same problem occurs in IE and FF, does anyone know a solution to this problem?
Thanks!