解决方案 »
- 关于SQLNCLI10.1和SQLOLEDB.1,郁闷
- 讨论:关于数据库应用程序开发的那点事。
- 想在一个edit的onchange事件中实现多字段模糊查询
- 怎么在delphi中将office文件直接转化成htm或者html格式而且不出现乱码?
- 在多线程的过程中ADOQuery1追加记录,不能调用外部的自定义过程来添加数据?
- dbgrid有条件填充问题
- 高手看下代码。。。。郁闷的要死,很简单的问题
- 厦门招聘Delphi技术员/工程师。
- 为什么我在用InterBase时会出现Your user name and password are not defined. Ask your database administrator to set up an InterBase login。
- 在delphi 中如何实现存储
- 简单删除的问题
- C++ 转 delphi!100分
//uses MShtml;
var
doc: IHTMLDocument2;
mhref: IHTMLAnchorElement;
mElem: IHTMLElement;
mElemColl: IHTMLElementCollection;
mImg: IHTMLImgElement;
i,j: integer;
mDispatch: IDispatch;
mstr: string;
begin
Memo1.Lines.Clear;
doc := WebBrowser1.Document as IHTMLDocument2;
for i:=0 to doc.all.length-1 do
begin
mDispatch := doc.all.item(i,0);
if succeeded(mDispatch.QueryInterface(IHTMLAnchorElement,mhref)) then
begin
mstr := mhref.href + ';' + mhref.target + ';';
mElem := mhref as IHTMLElement;
mstr := mstr + mElem.innerText;
mDispatch := mElem.children;
if succeeded(mDispatch.QueryInterface(IHTMLElementCollection,mElemColl)) then
begin
if mElemColl.length>0 then
begin
for j:=0 to mElemColl.length-1 do
begin
mDispatch := mElemColl.item(j,0);
if succeeded(mDispatch.QueryInterface(IHTMLImgElement,mImg)) then
mstr := mstr + ';imgsrc:' + mImg.src
else
mstr := mstr + mElem.innerHTML; //非IMG类型显示全部内容
end;
end;
end;
Memo1.Lines.Add(mstr);
end;
end;
end;
显示结果:
http://www.zzz.com/;_blank;Test2
http://www.xxx.com/;_blank;Test;imgsrc:http://www.aaa.com/bbb.jpg
http://www.yyy.com/;_blank;test3;imgsrc:http://www.aaa.com/bbb.jpg