Hi, i want to create a table declared inside a <td> , which already
exists as follows:
<tr>
<td id="prueba" colspan="4">
</td>
</tr>
I have a button somewhere calling this script, which i have reduced as
much for this post:
function prueba()
{
var tdpadre = document.getElementById("prueba");
var tabla = document.createElement("table");
tabla.setAttribute("id","tablaaseg");
tabla.setAttribute("name","tablaaseg");
tabla.setAttribute("width","100%");
var cantidadasegurados =
document.getElementById("txtnumbene").value;
for (i=0;i<cantidadasegurados;i++)
{
var row = document.createElement("tr");
var td1 = document.createElement("TD");
var inputnombre = document.createElement("input");
td1.appendChild(inputnombre);
row.appendChild(td1);
tabla.appendChild(row);
}
tdpadre.appendChild(tabla);
}
Documentation:
-Get the td where i am going to insert the table
-Create the table and set some attributes
-Get the value of an input, which contains a number. I will be creating
x numbers of rows, with 1 td inside each row
-The td will have an input inside it, so i create it.
-Append the td as a child of the tr, then the tr as a child of the
table
-Finally, add the table as child of the parent td.
This works on mozilla and opera, but not on IE. I dont get a yellow
icon , it just doesn't do anything.
Can anyone tell me what i am doing wrong?