Table creation with cell spacing of 0 on IE

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top