dlouwe
05-04-2007, 06:25 PM
Essentially what I am doing is creating a table using javascript, but when I try to add a second TD element to the second TR, it appears not to be there. At least, it doesn't in IE; this works fine in FF.
( this.newElement is a function I've defined for creating dom elements, it has other parameters but I've excluded them for simplicity's sake )
var objDIV = this.newElement("div");
var objTABLE = this.newElement("table");
var objTBODY = this.newElement("tbody");
var objTR1 = this.newElement("tr");
var objTR2 = this.newElement("tr");
var objTD1 = this.newElement("td");
var objTD2 = this.newElement("td");
var objTD3 = this.newElement("td");
var objIFRAME1 = this.newElement("iframe");
var objIFRAME2 = this.newElement("iframe");
objTD1.setAttribute("colspan","2");
document.body.appendChild( objDIV );
objDIV.appendChild( objTABLE );
objTABLE.appendChild( objTBODY );
objTBODY.appendChild( objTR1 );
objTBODY.appendChild( objTR2 );
objTR1.appendChild( objTD1 );
objTD2.appendChild( objIFRAME1 );
objTD3.appendChild( objIFRAME2 );
objTR2.appendChild( objTD2 );
objTR2.appendChild( objTD3 );
I have an inkling that it has to do with the colspan, but I've attempted several methods for setting it and none have worked.
( this.newElement is a function I've defined for creating dom elements, it has other parameters but I've excluded them for simplicity's sake )
var objDIV = this.newElement("div");
var objTABLE = this.newElement("table");
var objTBODY = this.newElement("tbody");
var objTR1 = this.newElement("tr");
var objTR2 = this.newElement("tr");
var objTD1 = this.newElement("td");
var objTD2 = this.newElement("td");
var objTD3 = this.newElement("td");
var objIFRAME1 = this.newElement("iframe");
var objIFRAME2 = this.newElement("iframe");
objTD1.setAttribute("colspan","2");
document.body.appendChild( objDIV );
objDIV.appendChild( objTABLE );
objTABLE.appendChild( objTBODY );
objTBODY.appendChild( objTR1 );
objTBODY.appendChild( objTR2 );
objTR1.appendChild( objTD1 );
objTD2.appendChild( objIFRAME1 );
objTD3.appendChild( objIFRAME2 );
objTR2.appendChild( objTD2 );
objTR2.appendChild( objTD3 );
I have an inkling that it has to do with the colspan, but I've attempted several methods for setting it and none have worked.