IE的BUG
因为IE的DOM规则中包含TBODY,添加一个就可以了
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
th {font-size: 8pt; font-family: Times New Roman;}</style>
<script>
<!--
window.onload=function()
{
try{
var tp=document.getElementById('Table-Position');
var tt=CreateTable();
tp.appendChild(tt);
tp.appendChild(document.createTextNode('FU'));
}catch(e)
{
alert(e.name + ": " + e.message);
}
}
function CreateTable()
{
var tt=document.createElement("table");
var tbody=document.createElement("tbody")
tt.appendChild(tbody);
tt.border='1';
tt.id='TimeTable';
tt.cellspacing='0';
tt.bordercolor='#6699ff';
tt.align='center';
var time=new Date(2006, 4, 12, 8, 0, 0, 0);
for(var i=0;i<6;i++)
{
var tr=document.createElement("tr");
for(var j=0;j<18;j++)
{
var hd=document.createElement("td");
if(i==0)
{
hd=document.createElement("th");
hd.width='30';
if(j==0)
{
hd.appendChild(document.createTextNode("&nbsp;"));
}else{
var Ttime=new Date(time+1800000*j);
hd.appendChild(document.createTextNode(Ttime.getHours()+':'+Ttime.getMinutes()));
}
}
if(j==0&&i!=0)
{
hd=document.createElement("th");
hd.appendChild(document.createTextNode('周'+i));
}
hd.id=i+'-'+j;
tr.appendChild(hd);
}
tbody.appendChild(tr);
}
return tt;
}
-->
</script>
<title>时间表拖拽测试页面 </title>
</head><body><div id="Table-Position">&nbsp;
</div>
<hr>
</body></html>