procedure TForm1.Button5Click(Sender: TObject); var doc: IHTMLDocument2; //uses MSHtml; begin doc := wb1.Document as IHTMLDocument2; doc.DesignMode := 'on'; end;不好意思,原来看走题了,是这意思吧。
webbrowser1.Navigate('about:blank'); while webbrowser1.busy do Application.ProcessMessages; (webbrowser1.Document as IHTMLDocument2).designMode :='on';
uses mshtml;procedure TForm1.FormCreate(Sender: TObject);
begin
wb1.Navigate('d:\mmm.htm');
end;procedure TForm1.Button5Click(Sender: TObject);
var
doc: IHTMLDocument2;
mDiv: IHTMLElement;
begin
doc := wb1.Document as IHTMLDocument2;
mDiv := doc.all.item('id2',0) as IHTMLElement;
mDiv.innerHTML := 'test';
end;
mmm.htm的内容<html>
<head>
</head>
<body>
<div id='id1'>ccc</div>
<div id='id2'>abc</div>
</body>
</html>
procedure TForm1.Button5Click(Sender: TObject);
var
doc: IHTMLDocument2; //uses MSHtml;
begin
doc := wb1.Document as IHTMLDocument2;
doc.DesignMode := 'on';
end;不好意思,原来看走题了,是这意思吧。
while webbrowser1.busy do
Application.ProcessMessages;
(webbrowser1.Document as IHTMLDocument2).designMode :='on';