以下能删除,但删除后会报错!<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> IEthis.navigate('d:/temp.htm');<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> doc:IHTMLDocument2;<br> all:IHTMLElementCollection;<br> len,i,j:integer;<br> item:IHTMLElement;<br> it,newIt,x:variant;<br>begin<br> if Assigned(IEThis)then<br> begin<br> doc:=IEThis.Document as IHTMLDocument2;<br> all:=doc.Get_all;<br> len:=all.Get_length;<br> for i:=0 to len-1 do<br> begin<br> item:=all.item(i,varempty) as IHTMLElement;<br> if item.getAttribute('id',0) = 'a' then<br> begin<br> it:=item;<br> x:=it.all.tags('TR').length;<br> for j:=x-1 downto 0 do<br> begin<br> if it.all.tags('TR').item(j).id='1' then<br> begin<br> it.deleteRow(j);<br> break;<br> end;<br> end;<br> end;<br> end;<br> end;<br>end;<br><br><br><br><HTML><br><HEAD><br><TITLE> New Document </TITLE><br></HEAD><br><BODY><br><font >aaa</font><br><TABLE id='a' border=1><br> <TR id='1'><TD>111</TD><TD>2222222</TD><TD>3333333</TD></TR><br> <TR id='2'><TD>bbbbb</TD><TD>bbb</TD><TD>cccc</TD></TR><br> <TR id='2'><TD>bbbbb</TD><TD>bbb</TD><TD>cccc</TD></TR><br></TABLE><br><font >aaa</font><br></BODY><br></HTML><br>