MSIE8 compatibility mode not rendering dynamically created table

Posted by KristoferA - Huagati.com on Stack Overflow See other posts from Stack Overflow or by KristoferA - Huagati.com
Published on 2010-03-09T04:40:11Z Indexed on 2010/03/09 4:51 UTC
Read the original article Hit count: 321

Filed under:
|
|

A bit weird... ...if running in IE8 quirks mode, the table added by the following code doesn't render. Can anyone tell me why, because it is not obvious to me..?

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
function AddTable()
{
  var table = document.createElement('table');
  var row = document.createElement('tr');
  table.appendChild(row);
  var cell = document.createElement('td');
  cell.innerHTML='abc';
  row.appendChild(cell);
  var divContainer = document.getElementById('divContainer');
  divContainer.appendChild(table);
}
</script>
</head>
<body>
<div id='divContainer'>
</div>
<input type='button' value='add table' onclick='javascript:AddTable()' />
</body>
</html>

© Stack Overflow or respective owner

Related posts about ie8

Related posts about quirks-mode