HighDots Forums  

Re: All browsers are cool but IE: div, form, table, input.. where's the table?

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: All browsers are cool but IE: div, form, table, input.. where's the table? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sundew Shin
 
Posts: n/a

Default Re: All browsers are cool but IE: div, form, table, input.. where's the table? - 06-01-2006 , 10:00 PM






A ha! 'tbody' was the keyword here. Thanks a lot!
I tried many different things. for example, adding this codeline at the
end of the script block seemed work:

div.innerHTML = div.innerHTML; // could be just: div.innerHTML += '';

This showed the table containing the input element, but 'form.submit()'
didn't work anymore. so I compared the innerHTML of the div before the
codeline and after the codeline and noticed that the only difference is
the existence of '<TBODY>' element.
Since I usually just ignored these elements, THEAD, TBODY, TFOOT, I
just ignored it, but, there you go. that was the thing.

Now everyone is happy. =)
So, for IE, is it general that we should provide at least 'tbody' when
we construct a table using 'createElement'?

Again. thank you so much. you saved whole lot of my time and headache.
=)

BootNic wrote:
Quote:
/*
var tbody=document.createElement('tbody')
table.appendChild(tbody);
var tr = document.createElement('tr');
tbody.appendChild(tr);
*/

//OR

/*
table.insertRow(-1);
var tr=table.rows[table.rows.length-1];
*/


Reply With Quote
  #2  
Old   
Randy Webb
 
Posts: n/a

Default Re: All browsers are cool but IE: div, form, table, input.. where'sthe table? - 06-01-2006 , 10:12 PM






Sundew Shin said the following on 6/1/2006 10:00 PM:
Quote:
A ha! 'tbody' was the keyword here. Thanks a lot!
With regards to tables, tbodys, and browsers, IE gets this one right and
everybody else gets it wrong.

Quote:
I tried many different things. for example, adding this codeline at the
end of the script block seemed work:

div.innerHTML = div.innerHTML; // could be just: div.innerHTML += '';
That is because IE is normalizing it (adding the TBODY) then reinserting it.

Quote:
This showed the table containing the input element, but 'form.submit()'
didn't work anymore. so I compared the innerHTML of the div before the
codeline and after the codeline and noticed that the only difference is
the existence of '<TBODY>' element.
Yep. IE normalized it to fix incomplete code.

Quote:
Since I usually just ignored these elements, THEAD, TBODY, TFOOT, I
just ignored it, but, there you go. that was the thing.

Now everyone is happy. =)
So, for IE, is it general that we should provide at least 'tbody' when
we construct a table using 'createElement'?
Yes.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #3  
Old   
RobG
 
Posts: n/a

Default Re: All browsers are cool but IE: div, form, table, input.. where'sthe table? - 06-01-2006 , 10:21 PM



Randy Webb wrote:
Quote:
Sundew Shin said the following on 6/1/2006 10:00 PM:
A ha! 'tbody' was the keyword here. Thanks a lot!

With regards to tables, tbodys, and browsers, IE gets this one right and
everybody else gets it wrong.
IE seems to pick the strangest times to decide to strictly interpret the
W3C DOM Spec.


Quote:
I tried many different things. for example, adding this codeline at the
end of the script block seemed work:

div.innerHTML = div.innerHTML; // could be just: div.innerHTML += '';

That is because IE is normalizing it (adding the TBODY) then reinserting
it.

This showed the table containing the input element, but 'form.submit()'
didn't work anymore. so I compared the innerHTML of the div before the
codeline and after the codeline and noticed that the only difference is
the existence of '<TBODY>' element.

Yep. IE normalized it to fix incomplete code.
'Incomplete' but standards compliant. The tbody tags are optional,
though the element isn't. :-)


Quote:
Since I usually just ignored these elements, THEAD, TBODY, TFOOT, I
just ignored it, but, there you go. that was the thing.

Now everyone is happy. =)
So, for IE, is it general that we should provide at least 'tbody' when
we construct a table using 'createElement'?

Yes.
Or use insertRow.


--
Rob


Reply With Quote
  #4  
Old   
Tony
 
Posts: n/a

Default Re: All browsers are cool but IE: div, form, table, input.. where'sthe table? - 06-02-2006 , 01:41 PM



RobG wrote:
Quote:
Randy Webb wrote:

Since I usually just ignored these elements, THEAD, TBODY, TFOOT, I
just ignored it, but, there you go. that was the thing.

Now everyone is happy. =)
So, for IE, is it general that we should provide at least 'tbody' when
we construct a table using 'createElement'?

Yes.

Or use insertRow.
Which I would recommend - I have seen createElement produce some unusual
results at times, but insertRow seems to work rather consistently across
multiple platforms.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.