This article mainly introduces the IE6-IE9 tbody innerHTML can not assign value to the solution, very practical, need friends can refer to the IE6-IE9 tbody innerHTML can not assign value, reproduce the Code as follows
Js Code
InnerHTML of tbody in IE6-IE9 cannot copy bug
GETSET
Script var tbody = document. getElementsByTagName ('tbody') [0] function setTbody () {tbody. innerHTML ='Bbb'} Function getTbody () {alert (tbody. innerHTML)} btn1.onclick = function () {getTbody ()} btn2.onclick = function () {setTbody ()} script
Two buttons: the first to get the innerHTML of the tbody and the second to set the innerHTML of the tbody.
When getting, all browsers pop up the tr string, but the IE6-9 is not supported at the time of the setting, and an error is reported,
You can use the feature to determine whether the browser supports tbody innerHTML settings.
var isupportTbodyInnerHTML = function () {var table = document.createElement('table')var tbody = document.createElement('tbody')table.appendChild(tbody)var boo = truetry{tbody.innerHTML = ''} catch(e) {boo = false}return boo}()alert(isupportTbodyInnerHTML)
Click to see if the browser you are browsing this blog supports
Click Me