Javascript Event object Detailed [collected]

Javascript Javascript Event object used to describe the event, which a major role in IE4 and NN4 each browser version in the future. Event event on behalf of the state, such as elements of the incident, the state of the keyboard, mouse position and mouse button state. Once the event occurs, it will generate an Event object, such as clicking a button, the browser's memory to generate the corresponding event object.

IE references to events

In the above versions of IE4, event object as a window attribute access: window.event. window portion is optional cited therein. So the script is like to be treated as a global event object references:

event.propertyName

event object members table:

The following table lists the members of the event object is drawn.

Object
dataTransfer provides access to predefined clipboard format, for use in the drag operation.

Collection of
bookmarks return tied to the rows affected by the current events of the ActiveX & reg; Data Objects (ADO) bookmarks.
boundElements return all bound to set all the elements of a given set of data on the page.

Properties
Abstract Abstract using the event object to get the contents of the file in the project banner Advanced Stream Redirector (ASX).
altKey set or obtain the status of the Alt key. Retrieves the current state of the ALT key value may be close to true, false not closed
altLeft set or get left Alt key state.
Banner using the event object to get Advanced Stream Redirector (ASX) Banner file content items.
Get the mouse button or button provided by the user.
Possible values:
0 No button
1 press Left
2 Right
3 Right Left
4 key intermediate press
5 and press the left key intermediate
6 and intermediate right-button
7 press all keys

cancelBubble set whether or not the current event in the event handler bubbled up.
Whether to set or retrieve the current event event handler blistering Possible values: false true canceling the event enabled blistering blistering

clientX set or get x coordinate of the mouse pointer position relative to the client area of the window,
where the window client area does not include its own control and scroll bars.
It is read-only, with no default.
clientY or set the mouse pointer relative to the y coordinate of the client area of the window,
where the client does not include a window region itself and scroll bars.
It is read-only, with no default.
clientX, clientY not consider the document scrolls, if we want to form a rolling count included, plus document.body.scrollLeft, document.body.scrollTop to

contentOverflow for indications that the current document processing LayoutRect Object contains additional content.
ctrlKey set or obtain the status of the Ctrl key. ctrlKey CTRL key to retrieve the current state of possible values true false not to shut off
ctrlLeft set or get the state of the left Ctrl key.
dataFld set or get oncellchange events affecting the data columns.
fromElement Sets or activate when an event occurs or the mouse to leave.

keyCode set or get the results in key events associated with the Unicode key code.
This property is used together with onkeydown onkeyup onkeypress If no keyword trigger event, then the value is 0,
with the String.fromCharCode) can be converted (character code into a character string.

The MoreInfo acquired Advanced Stream Redirector (ASX) by the event object MoreInfo content file project banner.
nextPage acquire the position to print the template on the next page.
offsetX or set the mouse pointer with respect to the x coordinates of the object triggering event.
offsetY or set the mouse pointer y coordinates of the object relative to a triggering event.
propertyName set or get property names have changed on the object.
qualifier set or get the name of the data provided by the members of the data source object.
reason set or retrieves data transmission result data source object.
Possible values:
0 successful data transmission,
a data transmission fails
second data transmission error

recordset set or get data from the source object reference to the default set of data. This feature is read-only
repeat Gets whether onkeydown event is repeated. This property can only be repeated if the event onkeydown return to true
returnValue set or get the return value of the event.
Possible values:
true value is returned in the event
on the false event source object default action is canceled

saveType get the clipboard type when oncontentsave trigger.

screenX set or get the mouse pointer with respect to the x-coordinate of the user's screen.
screenY or set the mouse pointer relative to the y coordinate of the user's screen.
(I.e., the mouse pointer with respect to the XY coordinate value of the upper left corner of the user's display)

shiftKey Gets or sets the state of the Shift key. Possible values close to true, false is not closed

shiftLeft set or get the state of the left Shift key.
srcElement Sets or trigger event. (Document element events)
srcFilter set or get onfilterchange filter object trigger event.
srcUrn event gets triggered behavior Uniform Resource Name (URN).
Unless the following conditions are true, otherwise this feature is set to null
1. behavior is attached to the factors triggering event
2. behavior defined in the previous bullet has a URN specifies the identifier of the trigger event and hexyl

toElement Sets or the user wants to move the mouse pointer to a reference.
Gets the name of the event type from the event object. As the Click, mouseOver
wheelDelta set or get the wheel button to scroll distance and direction.
x or set the mouse pointer to the x coordinate of the pixel of the parent document.
y or set the mouse pointer with respect to the y coordinate of the pixel of the parent document.


Note

event objects are only available in the event ── This means that you can use the object in the event handler, but can not be used in other code.

Although all event properties can be accessed by all event objects, but in certain events in certain properties may meaningless. For example, fromElement and toElement property only makes sense when dealing with onmouseover and onmouseout events.

In Microsoft Visual Basic & reg; script version (VBScript), you must access the event object through the window object.

This object in Microsoft & reg; Internet Explorer 4.0 is available scripts.

Examples

The following example uses the event object to determine whether the user clicked on the link position, and avoid pressing the SHIFT key to navigate to the link.

<HTML>
<HEAD><TITLE>取消链接</TITLE>
<SCRIPT LANGUAGE="JScript">
function cancelLink() {
if (window.event.srcElement.tagName == "A" && window.event.shiftKey)
window.event.returnValue = false;
}
</SCRIPT>
<BODY onclick="cancelLink()">

For each Event object property or method can be implemented, should be selected IE5.5 above.

 

Reproduced in: https: //my.oschina.net/cjkall/blog/195893

Guess you like

Origin blog.csdn.net/weixin_34377919/article/details/91756167