aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Setting div's innerhtml behaves differently in IE and Mozilla Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Setting div Watch "Setting div New topic
Author

Setting div's innerhtml behaves differently in IE and Mozilla

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
I have a table and have some rows in it.In one of the td(cell) i have some text + a empty DIV tag inside it as shown in below code:



Using javascript when i am inserting some html into the div having id "div1" that is

div1.innerHTML = "my html code here"

the gap increases between ROW 2 and ROW 3 in Internet Explorer version 6.0 while the same is working fine in Mozilla version 5.0

So can anybody please let me know the reason behind this behavior and how can i make this work correctly ??

Thanks
[ August 04, 2007: Message edited by: Jignesh Gohel ]

Regards,
Jignesh

The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60975
    
  65

I'm not sure if I understand exactly what you mean, but I think I may know what you are talking about.

IE is pretty stupid about empty cells, and it's probably changing the height of the cell once you add something to it.

The first thing I'd try is to not leave the cell empty, but put a non-breaking space in it so that IE doesn't think it's empty:

<div id="div1">&nbsp;</div>
[ August 04, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1174
Jignesh,

What do you mean by saying? �


the gap increases between ROW 2 and ROW 3 in Internet Explorer version 6.0 while the same is working fine in Mozilla version 5.0



BTW, div1 is actually in ROW2, right?

Maybe you want to take HEIGHT: 587px and spread it evenly across the three rows by using a div of 587px/3 for each one of them....

Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting div's innerhtml behaves differently in IE and Mozilla