共用方式為


IHTMLEventObj interface

This interface provides access to the event processes, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons.

Members

The IHTMLEventObj interface inherits from the IDispatch interface. IHTMLEventObj also has these types of members:

  • Properties

Properties

The IHTMLEventObj interface has these properties.

Property Description

altKey

Retrieves a value that indicates the state of the ALT key. For the standards based property, see IDOMKeyboardEvent::altKey.

button

Sets or retrieves the mouse button pressed by the user.

This property is not supported for Windows apps using JavaScript. For the standards based property that can be used with Windows apps using JavaScript , see IDOMMouseEvent::button.

cancelBubble

Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.

clientX

Sets or retrieves the x-coordinate of the mouse pointer, or user's finger, position relative to the client area of the window, excluding window decorations and scroll bars. For the standards based property, see IDOMMouseEvent::clientX.

clientY

Sets or retrieves the y-coordinate of the mouse pointer, or user's finger, position relative to the client area of the window, excluding window decorations and scroll bars.

ctrlKey

Sets or retrieves the state of the CTRL key. For the standards based property, see IDOMKeyboardEvent::ctrlKey.

fromElement

Sets or retrieves the object from which activation or the mouse pointer is exiting during the event.

keyCode

Sets or retrieves the Unicode key code associated with the key that caused the event.

offsetX

Sets or retrieves the x-coordinate of a pointer's position relative to the object firing the event.

offsetY

Sets or retrieves the y-coordinate of a pointer's position relative to the object firing the event.

reason

Sets or retrieves the result of the data transfer for a data source object.

returnValue

Sets or retrieves the return value from the event.

screenX

Sets or retrieves the x-coordinate of the mouse pointer's position relative to the user's screen. For the standards based property, see IDOMMouseEvent::screenX.

screenY

Sets or retrieves the y-coordinate of the mouse pointer's position relative to the user's screen. For the standards based property, see IDOMMouseEvent::screenY.

shiftKey

Retrieves the state of the SHIFT key. For the standards based property, see IDOMKeyboardEvent::shiftKey.

srcElement

Sets or retrieves the object that fired the event.

srcFilter

Sets or retrieves the filter object that caused the HTMLFrameSiteEvents::onfilterchange event to fire.

toElement

Sets or retrieves a reference to the object toward which the user is moving the mouse pointer or, for a touch device, a finger.

type

Sets or retrieves the event name from the event object.

x

Sets or retrieves the x-coordinate (in pixels) of the mouse pointer, or user's finger, offset from the closest relatively positioned parent element of the element that fired the event.

y

Sets or retrieves the y-coordinate (in pixels) of the mouse pointer, or user's finger, offset from the closest relatively positioned parent element of the element that fired the event.

 

Remarks

The event object is only available during an event; that is, you can use it in event handlers but not in other code. Retrieve the event object by calling the IHTMLWindow2::event method.

Although all event properties are available to all event objects, some properties might not have meaningful values during some events. For example, the values retrieved by the IHTMLEventObj::fromElement and the IHTMLEventObj::toElement methods are meaningful only when processing the HTMLFrameSiteEvents::onmouseover and HTMLFrameSiteEvents::onmouseout events.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

IDispatch