Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InsertAdjacent() help

Status
Not open for further replies.

LewisReeder

IS-IT--Management
Jul 18, 2005
38
US
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...
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.........)
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top