IHTMLDocument2的所有成员、属性、方法、事件

 


转自:http://www.ydfzx.com/notice.php?id=2121

IHTMLDocument2 Interface
Gets information about the document, and examines and modifies the HTML elements and text in the document.

IHTMLDocument2 Members

activeElementGets the object that has the focus when the parent document has focus.
alinkColorSets or gets the color of all active links in the document.
allGets an interface pointer to a zero-based collection of all the elements in an HTML document.
anchorsGets an interface pointer to a zero-based collection of all the a objects in an HTML document.
appletsGets an interface pointer to a zero-based collection of all of the applet objects in an HTML document.
bgColorDeprecated. Sets or retrieves a value that indicates the background color behind the object.
bodyGets an interface pointer to the document body object.
charsetSets or retrieves the character set used to encode the object.
clearNot currently supported.
closeCloses an output stream and forces the sent data to display.
cookieSets or gets the string value of a cookie.
createElementCreates an instance of the element for the specified tag.
createStyleSheetCreates a style sheet for the document.
defaultCharsetGets the default character set from the current regional language settings.
designModeSets or gets a value that indicates whether the document can be edited.
domainSets or gets the security domain of the document.
elementFromPointReturns the element for the specified xcoordinate and the specified ycoordinate.
embedsGets an interface pointer to a zero-based collection of all of the embed objects in an HTML document.
execCommandExecutes a command on the current document, current selection, or the given range.
execCommandShowHelpDisplays help information for the given command identifier.
expandoSets or retrieves a value indicating whether arbitrary variables can be created within the object.
fgColorSets or gets the foreground (text) color of the document.
fileCreatedDateRetrieves the date the file was created.
fileModifiedDateRetrieves the date the file was last modified.
fileSizeRetrieves the file size.
fileUpdatedDateRetrieves the date the file was last updated.
formsGets an interface pointer to a zero-based collection of all the form objects in an HTML document.
framesGets an interface pointer to a zero-based collection of all of the frame objects in an HTML document, if the document contains the frameSet object. Gets an interface pointer to a zero-based collection of all of the iframe objects in the document, if the document contains the bodyobject.
imagesGets a pointer to the IHTMLElementCollection interface of the zero-based collection of all of the images in an HTML document. The images are in the same order as they appear in the document.
lastModifiedGets the date that the page was last modified, if the page supplies one.
linkColorSets or gets the color of the document links.
linksGets an interface pointer to a zero-based collection of all of the link objects and the area objects in an HTML document.
locationRetrieves an interface pointer to a location object.
mimeTypeRetrieves the MIME type for the file.
namePropGets the title of the document file.
onafterupdateSets or retrieves a pointer to the event handler function associated with the onafterupdate event.
onbeforeupdateSets or retrieves a pointer to the event handler function associated with the onbeforeupdate event.
onclickSets or retrieves a pointer to the event handler function associated with the onclick event.
ondblclickSets or retrieves a pointer to the event handler function associated with the ondblclick event.
ondragstartSets or retrieves a pointer to the event handler function associated with the ondragstart event.
onerrorupdateSets or retrieves a pointer to the event handler function associated with the onerrorupdate event.
onhelpSets or retrieves a pointer to the event handler function associated with the onhelp event.
onkeydownSets or retrieves a pointer to the event handler function associated with the onkeydown event.
onkeypressSets or retrieves a pointer to the event handler function associated with the onkeypress event.
onkeyupSets or retrieves a pointer to the event handler function associated with the onkeyup event.
onmousedownSets or retrieves a pointer to the event handler function associated with the onmousedown event.
onmousemoveSets or retrieves a pointer to the event handler function associated with the onmousemove event.
onmouseoutSets or retrieves a pointer to the event handler function associated with the onmouseout event.
onmouseoverSets or retrieves a pointer to the event handler function associated with the onmouseover event.
onmouseupSets or retrieves a pointer to the event handler function associated with the onmouseup event.
onreadystatechangeSets or retrieves a pointer to the event handler function associated with the onreadystatechange event.
onrowenterSets or retrieves a pointer to the event handler function associated with the onrowenter event.
onrowexitSets or retrieves a pointer to the event handler function associated with the onrowexit event.
onselectstartSets or retrieves a pointer to the event handler function associated with the onselectstart event.
openOpens a new window and loads a document specified by a given URL. Also, opens a new window that uses the urlparameter and the nameparameter to collect the output of the IHTMLDocument2::write method and the IHTMLDocument2::writeln method.
parentWindowGets a reference to the container object of the window.
pluginsGets an interface pointer to a zero-based collection of all of the embedobjects in an HTML document.
protocolSets or retrieves the protocol portion of a URL.
queryCommandEnabledReturns a Boolean value that indicates whether a specified command can be successfully executed using IHTMLDocument2::execCommand, given the current state of the document.
queryCommandIndetermReturns a Boolean value that indicates whether the specified command is in the indeterminate state.
queryCommandStateReturns a Boolean value that indicates the current state of the command.
queryCommandSupportedReturns a Boolean value that indicates whether the current command is supported on the current range.
queryCommandTextRetrieves the string associated with a command.
queryCommandValueReturns the current value of the document, range, or current selection for the given command.
readyStateRetrieves a value that indicates the current state of the object.
referrerGets the URL of the location that referred the user to the current page.
scriptsGets an interface pointer to a zero-based collection of all of the script objects in an HTML document.
securityNot implemented.
selectionGets an interface pointer to an object representing the active selection. The active selection can be an insertion point, a highlighted block of text, or another element in the document that the user or a script can carry out an action on.
styleSheetsGets an interface pointer to a zero-based collection of the style sheet objects exposed from the document object. Each style sheet object represents an individual style sheet that is defined for the document.
titleSets or gets the title of the document.
toStringRetrieves a string representation of the object.
URLSets or gets the URL for the current document.
vlinkColorSets or gets the color of the links that the user has visited.
writeWrites one or more HTML expressions to a document in the specified window.
writelnWrites one or more HTML expressions, followed by a carriage return, to a document in the specified window.

Remarks

Typically, every window object has a corresponding document object that you can get by calling the QueryInterface method with the IID_IHTMLDocument or IID_IHTMLDocument2 interface identifiers. Windows that contain HTML documents always have valid document objects; windows that contain documents in other formats might not have valid document objects.

In general, before you attempt to get the document object for a window that is not the current window, make sure that the source file associated with that window is an HTML document file or a file that can be represented as an HTML document, for example, a text file.

Interface Information

Stock Implementation mshtml.dll 
Custom implementation No 
Inherits from IDispatch 
Header and IDL files Mshtml.h, Mshtml.idl 
Minimum availability Internet Explorer 4.0 
Minimum operating systems Windows 95, Windows NT 4.0, Windows CE 2.12

http://msdn2.microsoft.com/en-us/library/aa752574(VS.85).aspx

//可以枚举所有的网页链接,然后循环取出即可。 
//下面是代码: 
//已经调试通过,注意:要在uses里引用mshtml单元。 
//效果图见下图: 
var 
    doc:   IHTMLDocument2; 
    all:   IHTMLElementCollection; 
    len,   i:   integer; 
    item:   OleVariant; 
begin 
    doc   :=   WebBrowser1.Document   as     IHTMLDocument2; 
    all   :=   doc.links;       
    len   :=   all.length; 
    for   i   :=   0   to   len-1   do 
    begin 
            item   :=   all.item(i,   varempty);   
            if   ListBox.IndexOf(item.href)   =   -1       then 
            begin 
                    ListBox1.Items.Append(item.href); 
            end; 
    end; 
end;

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值