![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
/* 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]; */ |
#2
| ||||
| ||||
|
|
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'? |
#3
| |||
| |||
|
|
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. |
|
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. |
|
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. |
#4
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |