rewrite table by js
Hi,
I want to rewrite a tabel (in another frame). This works but there are mistakes that I don't understand:
1) normally the table head is printed bold, after rewriting it is plain text?
2) if I want to have bold text (either by txt.bold() or by writing <b>txt</b> or by %ltb>txt .. those tags appear as plain text with in the tab-cell (not interpreted by the browser)?
3) I use insertRow(i) to have at the last place the new row, but I got the rows: 1,4,3,2 (1 is in the tab-head) and not 1,2,3,4 ?
Hre is my code: The function wrtRow works perfect, the cells are in the correct sequence using appendChild().
What is wrong?
var DOC = eval("parent.Oben.document");
var TAB = DOC.getElementById("TOPTAB");
TAB.deleteTHead();
// delete all rows
while(TAB.rows.length>0) TAB.deleteRow(0);
// t = "1!id1!text1;2!id2!text2;3!id3!text3"
var nT = t.split(";");
// nT.length is now the number tab-lines
if (nT.length>0) {
if ( nT[0].search("!") > -1 ) {
// 1st row should be in tab-head
wrtRow( TAB.createTHead().insertRow(0), nT[0] );
}
// Tab-Body:
for (var i=1; i < nT.length; i++) {
if ( nT[i].search("!") > -1 )
wrtRow( TAB.insertRow( i ), nT[i] );
}
}
|