<body>
<script>
function creatIndex()
{
vIndex=document.createElement("table");
vIndex.cellPadding="0";
vIndex.cellSpacing="0";
vIndex.border="0";
vIndex.width="100%";
document.body.appendChild(vIndex);
}
creatIndex();
</script>

解决方案 »

  1.   

    function creatIndex()
    {
             //如果已经存在id为tableId的表格,删除
             if(typeof document.all.tableId != "undefined")
                 document.all.tableId.removeNode(true); vIndex=document.createElement("table");
             //指定id为tableId
             vIndex.id="tableId"
    vIndex.cellPadding="0";
    vIndex.cellSpacing="0";
    vIndex.border="0";
    vIndex.width="100%";
    vTr=vIndex.insertRow(indexnum);
    vTd=vTr.insertCell(0);
    vTd.innerHTML="<input type='radio' name='rad'>";
    vTd=vTr.insertCell(1);
    vTd.width="70%";
    vTd.innerHTML="test";
    }