W
whisher
Hi.
I'm not able to understand
why this simple snippet doesn't
work with IE.
It works fine with FF and Opera 9.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" type="text/JavaScript">
function buildTable()
{
var content = document.getElementById('content');
var mTable = document.createElement('table');
mTable.setAttribute('cellspacing','0');
mTable.setAttribute('cellpadding','0');
var tr = document.createElement('tr');
var td = document.createElement('td');
td.appendChild(document.createTextNode('pippo'));
tr.appendChild(td);
mTable.appendChild(tr);
alert(mTable);
content.appendChild(mTable);
}
window.onload = function()
{
buildTable();
}
</script>
</head>
<body>
<div id="content"></div>
</body>
</html>
Bye
I'm not able to understand
why this simple snippet doesn't
work with IE.
It works fine with FF and Opera 9.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="JavaScript" type="text/JavaScript">
function buildTable()
{
var content = document.getElementById('content');
var mTable = document.createElement('table');
mTable.setAttribute('cellspacing','0');
mTable.setAttribute('cellpadding','0');
var tr = document.createElement('tr');
var td = document.createElement('td');
td.appendChild(document.createTextNode('pippo'));
tr.appendChild(td);
mTable.appendChild(tr);
alert(mTable);
content.appendChild(mTable);
}
window.onload = function()
{
buildTable();
}
</script>
</head>
<body>
<div id="content"></div>
</body>
</html>
Bye