473,394 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

DOM Cell Width in IE

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
Nov 21 '07 #1
1 1587
VUNETdotUS wrote:
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
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Nov 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Cedric Villat | last post by:
I'm messing around the width of a table and can't see to get it right. Let me explain what I am trying to do. I have 5 cells in 1 row. The first cell I would like to be 20% of the screen space. The...
23
by: MattB | last post by:
Hello please help, I have a table cell with a div in it. The div has a width of 300px. but when it is rendered it puts extra space into the table cell. Here's the style <style>...
4
by: Lan Vuong | last post by:
Hi everyone, I'm trying to retrieve the width of a cell as the table is being dynamically created and add it to a total. I can get the width from an eventhandler such as: <td...
5
by: Greg N. | last post by:
Hi folks, I have a table cell with a background image, something like <td background=landscape.jpg height=200></td> The sole purpose of this code is to display the image inside that table...
5
by: nivas.meda | last post by:
Hi, I have an excel sheet with a graph and cells.If i change the value in the excel cells the graph will reflect.Now i am going to implement this functionality in html page.I successfully saved...
1
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say...
6
by: tshad | last post by:
If you have nothing in a cell, the cell doesn't have the inset appearance that all the other cells do. Normally, you could just put a "&ndsp;" in the cell if the it is blank. But how do you do...
4
by: Hiwj | last post by:
I am having a problem with a cell in a table in ASP.NET which used to work OK in classic ASP. I have one cell in a row where the width should be 22 pixels and the other cell should take up the...
2
by: Jukka K. Korpela | last post by:
Sub titulo "Re: DIV borders different in IE7 when in td" scripsit Ben C: This seems to be the heart of the matter, and I'm trying to get a real discussion started, by moving the discussion to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.