DOM Cell Width in IE

V

VUNETdotUS

Hello,
I have a simple structure of table created in DOM:
table:
row1:
cell1 cell2
row2:
cell1 (colSpan=2)

cell2 has a style.width = "0px" because I hide it first. The if I need
to put something inside of cell2, I modify its style.width = "150px"
and put some innerHTML in.

The problem occurs when some DIV content is placed inside cell1 of
row2 (where colspan=2 is used). DIV content breaks the width of cell2
and it is not 150 as set but over 50% or something.

I tried: setting width of DIV to 90%, setting width instead of
style.width to cell2, a few more things but NOTHING worked. Any ideas?
It works fine in FF, and in IE when DIV is not appended.

Thanks
 
T

Thomas 'PointedEars' Lahn

VUNETdotUS said:
I have a simple structure of table created in DOM:
table:
row1:
cell1 cell2
row2:
cell1 (colSpan=2)

cell2 has a style.width = "0px" because I hide it first. The if I need
to put something inside of cell2, I modify its style.width = "150px"
and put some innerHTML in.

However, you should not. Instead, you should set style.display="none" to
hide the element and style.display="" to show it, and use a DOM Level 2
approach to modify both the element's content and the `colspan' attribute of
the first cell of the second row, respectively.
The problem occurs when some DIV content is placed inside cell1 of
row2 (where colspan=2 is used). DIV content breaks the width of cell2
and it is not 150 as set but over 50% or something.
See?

I tried: setting width of DIV to 90%, setting width instead of
style.width to cell2, a few more things but NOTHING worked. Any ideas?
It works fine in FF, and in IE when DIV is not appended.

Understanding HTML and CSS before attempting CSS DOM scripting would be a
good idea.


PointedEars
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top