By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

Table creation with cell spacing of 0 on IE

P: n/a
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

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


Andrew Poulos wrote:

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" );


Watch out for the case, it is cellSpacing
mytable.cellSpacing = "0"
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/cellspacing.asp>
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-68907883>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.