Connecting Tech Pros Worldwide Forums | Help | Site Map

Table DOM in Mozilla Vs. IE.

dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#1: Aug 27 '08
Have a look at my code snippet ...
Expand|Select|Wrap|Line Numbers
  1. function add_row(){
  2.  var tr = some_reference;
  3.  document.getElementById('tab_id').appendChild(tr);
  4. }
  5.  
Expand|Select|Wrap|Line Numbers
  1. <table id=tab_id>
  2. <tr id=tr_id>....</tr>
  3. .....
  4. </table>
  5.  
It works in Mozilla but not in IE.
If i do
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('tr_id').parentNode.appendChild(tr);
,
now it works in both :-)
Could you explain why this happens ..experts ?

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Aug 27 '08

re: Table DOM in Mozilla Vs. IE.


In IE, you need to append to the tbody rather than the table. See this part-article.
dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#3: Aug 27 '08

re: Table DOM in Mozilla Vs. IE.


Quote:

Originally Posted by acoder

In IE, you need to append to the tbody rather than the table. See this part-article.

Yeah i know that's why i knocked the experts ;)
One more thing now a days are you busy ? I thrown a discussion over the core topics ..functions and objects, you didn't take part in that
i expected you to throw something ...... ;)
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Aug 28 '08

re: Table DOM in Mozilla Vs. IE.


I did see that thread, but didn't participate in it. Some of the concepts I needed to figure out for myself before I could contribute, but I think it's resolved now.
dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#5: Aug 28 '08

re: Table DOM in Mozilla Vs. IE.


Quote:

Originally Posted by acoder

I did see that thread, but didn't participate in it. Some of the concepts I needed to figure out for myself before I could contribute, but I think it's resolved now.

Oh ...Sure man.
yeah it's now got figured out .....for myself ...
really thanks to Bytes.com experts team from here i came 2 know lot of details ..Java as well as JavaScript ;)

Basically i am also interested in C and C++ which are my heart ;) ...but i could not find out time to take part in those discussions ....
A lot of pressure in my work ...;(
Reply