LewisReeder
IS-IT--Management
I currently have a button that allows a user to add a table. When the user click the button, a copy of the (blank) table is displayed directly below the original. Each table has a unique ID and increments with each addition (idTable_1, idTable_2 and so on). As each table is added I need them to be add directly below the most recent addition. Right now my application adds the table directly below the original and puts each of the added tables down. For example if i was to add 3 additional tables this is how they would be stacked:
idTable_1
idTable_4
idTable_3
idTable_2
What i need is:
idTable_1
idTable_2
idTable_3
idTable_4
I am not sure how to use the insertAdjacent() method well enough to do this. Any help would be greatly appreciated.
here is some code...
idTable_1
idTable_4
idTable_3
idTable_2
What i need is:
idTable_1
idTable_2
idTable_3
idTable_4
I am not sure how to use the insertAdjacent() method well enough to do this. Any help would be greatly appreciated.
here is some code...
Code:
function add_Week()
{
var frm = document.frmTSC;
var doc = document.all;
var objRow, objCol, objHead, objBody, strHTML, objBreak;
var objTbl = document.all;
//incremented table number
var intWeekNum = parseInt(frm.tbxWeekNum.value, 10) + 1;
objTbl = document.createElement("TABLE");
frm.insertAdjacentElement("AfterEnd", objTbl);
objTbl.id = "idTable_" + (intWeekNum);
(table created.........)
}