oCell1.innerHTML  =  "<input  type='text'  id='field1'  value='这是文本1'>" 
document.getElementById("field1").className="tr_southidc";

解决方案 »

  1.   

    是行<TR>的ID啊!不过我搞出来了tbl = document.getElementById("MyTable");
    oRow = MyTable.insertRow(MyTable.rows.length);
    oRow.id=rowcounter;
    oRow.className="tr_southidc";
      

  2.   

    楼主的意思是要给动态生成的行一个id,然后设置行的class吧。
    试试这样:
    function btn_click()
    {
    var ll_rowcount = MyTable.rows.length;
    oRow = MyTable.insertRow(ll_rowcount);
    oRow.id = "your_id";
    oCell1 = oRow.insertCell();
    oCell2 = oRow.insertCell();
    oCell3 = oRow.insertCell();
    oCell4 = oRow.insertCell();
    oCell1.innerHTML = "<input type='text' name='field1' value='这是文本1'>"
    oCell2.innerHTML = "<input type='text' name='field2' value='这是文本2'>";
    oCell3.innerHTML = "<input type='text' name='field3' value='这是文本3'>";
    oCell4.innerHTML = "<input type='text' name='field4' value='这是文本4'>";
    document.getElementById("your_id").className="tr_southidc";
    }
    //-->
    </SCRIPT>