• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting div's innerhtml behaves differently in IE and Mozilla

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic