A
Andrew Poulos
I'm trying to build a table using DOM methods with script that follows
this type of format:
// note the var bodyEl is predefined as the body element
//
var mytable = document.createElement("TABLE");
var mytablebody = document.createElement("TBODY");
// First row
var mycurrent_row = document.createElement("TR");
var mycurrent_cell = document.createElement("TD");
var currenttext = document.createTextNode("Some text here.");
// append everything
mycurrent_cell.appendChild(currenttext);
mycurrent_row.appendChild(mycurrent_cell);
mytablebody.appendChild(mycurrent_row);
mytable.appendChild(mytablebody);
bodyEl.appendChild(mytable);
This is working except that I've styled the table with one colour border
and the cell with a different colour border and I want the two borders
to abut.
With FF I just set border-spacing to 0 but IE doesn't support this CSS
property. So I need to go back to the old cellspacing attribute.
My problem is that I can't seem to 'attach' it to the table. I've tried
the following to no avail:
mytable.cellspacing = "0";
mytable.setAttribute("cellspacing ", "0" );
Is there some way to do this?
Andrew Poulos
this type of format:
// note the var bodyEl is predefined as the body element
//
var mytable = document.createElement("TABLE");
var mytablebody = document.createElement("TBODY");
// First row
var mycurrent_row = document.createElement("TR");
var mycurrent_cell = document.createElement("TD");
var currenttext = document.createTextNode("Some text here.");
// append everything
mycurrent_cell.appendChild(currenttext);
mycurrent_row.appendChild(mycurrent_cell);
mytablebody.appendChild(mycurrent_row);
mytable.appendChild(mytablebody);
bodyEl.appendChild(mytable);
This is working except that I've styled the table with one colour border
and the cell with a different colour border and I want the two borders
to abut.
With FF I just set border-spacing to 0 but IE doesn't support this CSS
property. So I need to go back to the old cellspacing attribute.
My problem is that I can't seem to 'attach' it to the table. I've tried
the following to no avail:
mytable.cellspacing = "0";
mytable.setAttribute("cellspacing ", "0" );
Is there some way to do this?
Andrew Poulos