i already have a form and a table and data from the form is added to the table but i'm trying to add a insertBefore function for my form but it doesn't work. could you please tell me what is wrong with my script?
function insertBefore(){
var table = document.getElementById('table');
var row = document.createElement('tr');
var td1 = document.createElement('td');
var td2 = document.createElement('td');
var td3 = document.createElement('td');
td1.innerHTML = document.getElementById('name').value;
td2.innerHTML = document.getElementById('address').value;
td3.innerHTML = document.getElementById('email').value;
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
table.tBodies [0].insertBefore();
}
Thanks.