本文整理自网络,侵删。
procedure TForm1.btn1Click(Sender: TObject);var doc:olevariant; str:string;begin doc:=wb1.Document; //获取元素的值 {str:=doc.all.xx.value; ShowMessage(str);}
//写入htnl {doc.clear; doc.write('<html><head></head><body><p>新的html</p><input type="hidden" value="0" id="xx" /></body></html>'); doc.close;}
//改变元素的值 {doc.all.xx.value:='1'; ShowMessage(doc.all.xx.value);}
//获得html文本 str:=doc.documentElement.outerHtml; ShowMessage(str);end;
相关阅读 >>
Delphi tstreamreader tfile assignfile读取文本文件
更多相关阅读请进入《Delphi》频道 >>