Home Database Mysql Tutorial IHTMLElement和IHTMLElement2接口

IHTMLElement和IHTMLElement2接口

Jun 07, 2016 pm 03:49 PM
interface

IHTMLElement和IHTMLElement2是IE浏览器(WebBrowser控件,trident内核)的两个同系列针对文档元素的接口。这两个接口都提供了以编程方式访问常见的所有元素对象的属性和方法的途径。 一、 下面还是先介绍IHTMLElement接口 。 IHTMLElement接口里有不少的变量和

        IHTMLElement和IHTMLElement2是IE浏览器(WebBrowser控件,trident内核)的两个同系列针对文档元素的接口。这两个接口都提供了以编程方式访问常见的所有元素对象的属性和方法的途径。

       一、下面还是先介绍IHTMLElement接口

      IHTMLElement接口里有不少的变量和函数,其变量大多是文档元素的属性,比如class、id、attribute、lang、tagName、InnerText、InnerHtml、OuterText、OuterHtml、child、parentElement等,还有部分是style属性,比如offsetHeight、offsetLeft、style等,另外有一部分关于该元素的动作属性,比如onclick、ondragstart、onmousedown、onmousemove等。在这些成员属性之外,还有成员方法,比如click()、getAttribute(..),另外一部分成员方法就是针对各个成员变量安排的成员函数(getXX、setXX),比如id这个属性,HRESULT get_id(BSTR *p)、HRESULT put_id(BSTR *p),对于onmousedown这个成员属性,其对应的成员函数是HRESULT get_onmousedown(VARIANT *p)、HRESULT put_onmousedown(VARIANT *p),其中VARIANT是VT_IDISPATCH类型,其细化了IDispatch接口。

all                  Retrieves the collection of all the objects in the HTML that are within the scope of this object.

children         Retrieves the collection that contains all the immediate children of this object.

className    Sets or retrieves the class of the object.

click              Simulates a click by causing the onclick event to fire.

contains       Checks whether the given element is contained within the object.

document     Gets the document object for the document that the browser is displaying.

filters            Retrieves a collection of filters for an element.

getAttribute    Retrieves the value of the specified attribute.

id                  Sets or retrieves the string identifying the object.

innerHTML    Gets or sets the HTML between the start and end tags of the object.

innerText      Sets or retrieves the text between the start and end tags of the object.

insertAdjacentHTML         Inserts the given HTML text into the element at the location.

insertAdjacentText              Inserts the given text into the element at the specified location.

isTextEdit       Retrieves whether a TextRange object can be created using the object.

lang                Sets or retrieves the language to use.

language       Sets or retrieves the language in which the current script is written.

offsetHeight                     Retrieves the height of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

offsetLeft                         Retrieves the calculated left position of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

offsetParent                                                   Retrieves a reference to the container object that defines the IHTMLElement::offsetTop and IHTMLElement::offsetLeft properties of the object.

offsetTop                         Retrieves the calculated top position of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

offsetWidth                     Retrieves the width of the object relative to the layout or coordinate parent, as specified by the IHTMLElement::offsetParent property.

onafter              updateSets or retrieves a pointer to the event handler function associated with the onafterupdate event.

onbeforeupdate            Sets or retrieves a pointer to the event handler function associated with the onbeforeupdate event.

onclick              Sets or retrieves a pointer to the event handler function associated with the onclick event.

ondataavailable             Sets or retrieves a pointer to the event handler function associated with the ondataavailable event.

ondatasetchanged        Sets or retrieves a pointer to the event handler function associated with the ondatasetchanged event.

ondatasetcomplete       Sets or retrieves a pointer to the event handler function associated with the ondatasetcomplete event.

ondblclick                      Sets or retrieves a pointer to the event handler function associated with the ondblclick event.

ondragstart                   Sets or retrieves a pointer to the event handler function associated with the ondragstart event.

onerrorupdate              Sets or retrieves a pointer to the event handler function associated with the onerrorupdate event.

onfilterchange              Sets or retrieves a pointer to the event handler function associated with the event.

onhelp                           Sets or retrieves a pointer to the event handler function associated with the onhelp event.

onkeydown                   Sets or retrieves a pointer to the event handler function associated with the onkeydown event.

onkeypress                  Sets or retrieves a pointer to the event handler function associated with the onkeypress event.

onkeyup                       Sets or retrieves a pointer to the event handler function associated with the onkeyup event.

onmousedown             Sets or retrieves a pointer to the event handler function associated with the onmousedown event.

onmousemove            Sets or retrieves a pointer to the event handler function associated with the onmousemove event.

onmouseout                Sets or retrieves a pointer to the event handler function associated with the onmouseout event.

onmouseover              Sets or retrieves a pointer to the event handler function associated with the onmouseover event.

onmouseup                 Sets or retrieves a pointer to the event handler function associated with the onmouseup event.

onrowenter                 Sets or retrieves a pointer to the event handler function associated with the onrowenter event.

onrowexit                    Sets or retrieves a pointer to the event handler function associated with the onrowexit event.

onselectstart              Sets or retrieves a pointer to the event handler function associated with the onselectstart event.

outerHTML                 Sets or retrieves the object and its content in HTML.

outerText                   Sets or retrieves the text of the object.

parentElement         Retrieves the parent object in the object hierarchy.

parentTextEdit         Retrieves the container object in the document hierarchy that can be used to create a TextRange containing the original object.

recordNumber         Retrieves the ordinal record from the data set that generated the object.

removeAttribute      Removes an attribute from an object.

scrollIntoView          Causes the object to scroll into view, aligning it either at the top or bottom of the window.

setAttribute              Sets the value of the specified attribute.

sourceIndex            Retrieves the ordinal position of the object, in source order, as the object appears in the document's all collection.

style                         Retrieves an inline style sheet for the tag.

tagName                 Retrieves the tag name of the object.

title                         Sets or retrieves advisory information (a ToolTip) for the object.

toString                   Retrieves a string representation of the object.

二、IHTMLElement2接口的介绍

      IHTMLElement2是在IHTMLElement接口基础上加了一些成员属性和方法,以满足浏览器升级的需求。其加的属性,如readyState、readyStateValue、currentStyle、与scroll(滑动条)有关的几个属性、capture、expression、behavior等属性及其设置与删除。

onpropertychange          Sets or retrieves a pointer to the event handler function associated with the onpropertychange event.

onreadystatechange      Sets or retrieves a pointer to the event handler function associated with the onreadystatechange event.

onresize                         Sets or retrieves a pointer to the event handler function associated with the onresize event.

onrowsdelete                 Sets or retrieves a pointer to the event handler function associated with the onrowsdelete event.

onrowsinserted             Sets or retrieves a pointer to the event handler function associated with the onrowsinserted event.

onscroll                         Sets or retrieves a pointer to the event handler function associated with the onscroll event.

readyState                    Retrieves the current state of the object.

readyStateValue           Gets the current state of the object.

releaseCapture             Removes mouse capture from the object in the current document.

removeBehavior            Detaches a behavior from the element.

removeExpression        Removes the expression from the specified property.

removeFilter                 Not implemented.

replaceAdjacentText    Replaces the text adjacent to the element.

runtimeStyle                Gets the element's runtimeStyle object.

scopeName                 Gets the namespace defined for the element.

scrollHeight                 Retrieves the scrolling height of the object.

scrollLeft                     Sets or retrieves the distance between the left edge of the object and the leftmost portion of the content currently visible in the window.

scrollTop                     Sets or retrieves the distance between the top of the object and the topmost portion of the content currently visible in the window.

scrollWidth                 Retrieves the scrolling width of the object.

setCapture                Sets the mouse capture to the object that belongs to the current document.

setExpression           Sets an expression for the specified object.

tabIndex                   Sets or retrieves the index that defines the tab order for the object.

tagUrn                       Sets or gets the URN specified in the namespace declaration.

canHaveChildren      Gets a value indicating whether the object can contain child objects.

        下面说下IHTMLElement2接口的版本等问题。注意,IHTMLElement接口只需要IE4及其以上版本即可。

      Interface Information

Stock Implementation                            mshtml.dll

Custom Implementation                          No

Inherits from                                            IDispatch

Header and IDL files                                Mshtml.h, Mshtml.idl

Minimum availability                                  Internet Explorer5

Minimum operating systems                      Windows 95, Windows NT 4.0, Windows CE 4.0


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
What are the internal interfaces of a computer motherboard? Recommended introduction to the internal interfaces of a computer motherboard What are the internal interfaces of a computer motherboard? Recommended introduction to the internal interfaces of a computer motherboard Mar 12, 2024 pm 04:34 PM

When we assemble the computer, although the installation process is simple, we often encounter problems in the wiring. Often, users mistakenly plug the power supply line of the CPU radiator into the SYS_FAN. Although the fan can rotate, it may not work when the computer is turned on. There will be an F1 error "CPUFanError", which also causes the CPU cooler to be unable to adjust the speed intelligently. Let's share the common knowledge about the CPU_FAN, SYS_FAN, CHA_FAN, and CPU_OPT interfaces on the computer motherboard. Popular science on the CPU_FAN, SYS_FAN, CHA_FAN, and CPU_OPT interfaces on the computer motherboard 1. CPU_FANCPU_FAN is a dedicated interface for the CPU radiator and works at 12V

Common programming paradigms and design patterns in Go language Common programming paradigms and design patterns in Go language Mar 04, 2024 pm 06:06 PM

As a modern and efficient programming language, Go language has rich programming paradigms and design patterns that can help developers write high-quality, maintainable code. This article will introduce common programming paradigms and design patterns in the Go language and provide specific code examples. 1. Object-oriented programming In the Go language, you can use structures and methods to implement object-oriented programming. By defining a structure and binding methods to the structure, the object-oriented features of data encapsulation and behavior binding can be achieved. packagemaini

Introduction to PHP interfaces and how to define them Introduction to PHP interfaces and how to define them Mar 23, 2024 am 09:00 AM

Introduction to PHP interface and how it is defined. PHP is an open source scripting language widely used in Web development. It is flexible, simple, and powerful. In PHP, an interface is a tool that defines common methods between multiple classes, achieving polymorphism and making code more flexible and reusable. This article will introduce the concept of PHP interfaces and how to define them, and provide specific code examples to demonstrate their usage. 1. PHP interface concept Interface plays an important role in object-oriented programming, defining the class application

Solution to NotImplementedError() Solution to NotImplementedError() Mar 01, 2024 pm 03:10 PM

The reason for the error is in python. The reason why NotImplementedError() is thrown in Tornado may be because an abstract method or interface is not implemented. These methods or interfaces are declared in the parent class but not implemented in the child class. Subclasses need to implement these methods or interfaces to work properly. How to solve this problem is to implement the abstract method or interface declared by the parent class in the child class. If you are using a class to inherit from another class and you see this error, you should implement all the abstract methods declared in the parent class in the child class. If you are using an interface and you see this error, you should implement all methods declared in the interface in the class that implements the interface. If you are not sure which

Application of interfaces and abstract classes in design patterns in Java Application of interfaces and abstract classes in design patterns in Java May 01, 2024 pm 06:33 PM

Interfaces and abstract classes are used in design patterns for decoupling and extensibility. Interfaces define method signatures, abstract classes provide partial implementation, and subclasses must implement unimplemented methods. In the strategy pattern, the interface is used to define the algorithm, and the abstract class or concrete class provides the implementation, allowing dynamic switching of algorithms. In the observer pattern, interfaces are used to define observer behavior, and abstract or concrete classes are used to subscribe and publish notifications. In the adapter pattern, interfaces are used to adapt existing classes. Abstract classes or concrete classes can implement compatible interfaces, allowing interaction with original code.

What is the difference between interfaces and abstract classes in PHP? What is the difference between interfaces and abstract classes in PHP? Jun 04, 2024 am 09:17 AM

Interfaces and abstract classes are used to create extensible PHP code, and there is the following key difference between them: Interfaces enforce through implementation, while abstract classes enforce through inheritance. Interfaces cannot contain concrete methods, while abstract classes can. A class can implement multiple interfaces, but can only inherit from one abstract class. Interfaces cannot be instantiated, but abstract classes can.

Insight into Hongmeng system: actual function measurement and usage experience Insight into Hongmeng system: actual function measurement and usage experience Mar 23, 2024 am 10:45 AM

As a new operating system launched by Huawei, Hongmeng system has caused quite a stir in the industry. As a new attempt by Huawei after the US ban, Hongmeng system has high hopes and expectations. Recently, I was fortunate enough to get a Huawei mobile phone equipped with Hongmeng system. After a period of use and actual testing, I will share some functional testing and usage experience of Hongmeng system. First, let’s take a look at the interface and functions of Hongmeng system. The Hongmeng system adopts Huawei's own design style as a whole, which is simple, clear and smooth in operation. On the desktop, various

Inner class implementation of interfaces and abstract classes in Java Inner class implementation of interfaces and abstract classes in Java Apr 30, 2024 pm 02:03 PM

Java allows inner classes to be defined within interfaces and abstract classes, providing flexibility for code reuse and modularization. Inner classes in interfaces can implement specific functions, while inner classes in abstract classes can define general functions, and subclasses provide concrete implementations.

See all articles