We can normally build tables using HTML and omit the tbody tag without issue. Browsers are supposed to assume a single tbody when none is explicitly given. So, we may naturally assume we can do the same using the DOM methods:
var table = document.createElement('table'); var tr = document.createElement('tr'); var td = document.createElement('td'); td.innerHTML = "oh hi."; tr.appendChild(td); table.appendChild(tr); document.body.appendChild(table);
And indeed, this works perfectly in Chrome, Safari, Firefox, and IE8+. However, IE7 silently adds the table to the body, but refuses to draw anything. IE7 fails to assume the tbody in this case. You need to explicitly add it, like so:
var table = document.createElement('table'); var tbody = document.createElement('tbody'); var tr = document.createElement('tr'); var td = document.createElement('td'); td.innerHTML = "oh hi."; tr.appendChild(td); tbody.appendChild(tr); table.appendChild(tbody); document.body.appendChild(table);
This will correct the issue in IE7 in without impacting other browsers. And, it'll provide a more accurate representation of the table in your script, which does include a tbody, even when not explicitly given.
JavaScript Online Training JavaScript Online Training JQuery Online Training JQuery Online Training
ReplyDeleteJavaScript Course | HTML5 Online Training
Wow. This really made my day. Thanks a lot!
ReplyDeleteJavascript Training in Chennai | HTML5 Online Training
JavaScript Training Courses | Javascript Online Training | Angular 2 Training in Chennai
Appreciate it to get serving outside, wonderful information. https://www.allmaxbet.com
ReplyDeleteYour favorite reason seemed to be on the net the easiest thing to be aware of. https://www.5g999.co/slot
ReplyDeleteเว็บบตรง pg slot game เว็บสล็อตมาแรง ตลอดระยะเวลา รองรับภาษาไทย พร้อมให้แก่ให้ทุกท่านที่พอใจเล่นเข้ามากระทำ ทดสอบเล่นเกมส์สล็อต pg slot ไม่เป็นอันตราย 100% คัดสรรแต่ว่าเกมประสิทธิภาพ
ReplyDeleteI've also added you to my blogroll. สนใจแทงบอลคลิก
ReplyDeleteTie ในเกมบาคาร่า autobet บาคาร่า คือ เกมเพื่อการเดิมพันอีกหนึ่งชนิดที่ได้รับความนิยมไม่น้อยเลยทีเดียว เพราะเป็นเกมเพื่อการเดิมพันที่...สนุกเล่นได้ที่ autobet
ReplyDeleteGood morning!! I am also blogging with you.
ReplyDeletemale masturbation cup
electric masturbation cup