The event object Javascript

2010-12-08  来源:本站原创  分类:Web  人气:113 

Javascript, Javascript Event object is used to describe the events, it IE4 and NN4 major role in future versions of each browser. Event status on behalf of the event, such as the elements of the incident, keyboard status, the mouse position and mouse button state. Once the event occurs, it will generate Event objects, such as the click of a button, the browser's memory to produce a corresponding event object.

IE reference to the incident

In the above version of IE4, event object as the window attribute access: window.envent. Citing the window part is optional. Therefore, as global references in the script to deal with event objects:

event. propertyName

Members of event object table

The following table lists the event object leads to the members.

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

Collection
bookmarks to return tied to the current line to the effect of the ActiveX ® Data Objects (ADO) bookmark collections.
boundElements Back to all bound to the given data set of all elements of the collection.

Properties
Abstract object using the event to get Advanced Stream Redirector (ASX) file, the contents of the project banners of the Abstract.
altKey Sets or Alt keys.
altLeft set or get the status of the left Alt key.
Banner object using the event to get Advanced Stream Redirector (ASX) file, the contents of the project's Banner.
button to set or get the user press the mouse button.
cancelBubble set or get whether the current event bubbled up in the event handler.
clientX set or the mouse pointer relative to the window client area of the x coordinate of the client area does not include the window itself and scroll bars.
clientY set or the mouse pointer relative to the y coordinate of the window client area, where the client area does not include the window itself and scroll bars.
contentOverflow to get that document processing is the current LayoutRect object contains additional content.
ctrlKey Sets or Ctrl keys.
ctrlLeft set or get the status of the left Ctrl key.
dataFld oncellchange events set or get the data column.
fromElement Sets or event activation or the mouse to leave the object.
keyCode set or get the keys and lead to events associated with Unicode key code.
MoreInfo through the event object to get Advanced Stream Redirector (ASX) file in the project banner MoreInfo content.
nextPage print template for the location of the next page.
offsetX set or get the mouse pointer relative to the trigger event's x coordinate of the object.
offsetY set or get the mouse pointer relative to the trigger event object y coordinates.
propertyName Sets or returns the name of the property on the changes.
qualifier set or access provided by the data source object data member name.
reason to set or get the data source object data transfer results.
recordset from the data source object to the default settings or to obtain a reference data set.
repeat for onkeydown event is being repeated.
returnValue for the event set or the return value.
saveType oncontentsave triggered when the type of access to the clipboard.
screenX set or get the mouse pointer relative to the screen x-coordinate.
screenY set or the mouse pointer relative to the screen y-coordinate.
shiftKey Sets or Shift keys.
shiftLeft set or get the status of the left Shift key.
srcElement set or get the object that triggered the event.
Sets or returns the trigger onfilterchange srcFilter event filter object.
srcUrn triggering event for the behavior of the Uniform Resource Name (URN).
toElement the user to set or get the mouse pointer moves point to the object.
type from the event object for the event name.
wheelDelta scroll wheel button to set or get the distance and direction.
x setting or the mouse pointer relative to the parent document of the x pixel coordinates.
y setting or the mouse pointer relative to the parent document of the y-pixel coordinates.

Notes

event object is available only in the event ─ ─ This means that you can use this event handler object, but not in other code.

Although all events are available through all the event attributes object access, but some properties in some events may be meaningless. For example, fromElement and toElement property is only when dealing with onmouseover and onmouseout events meaningful.

In Microsoft Visual Basic ® Scripting Edition (VBScript), you must access the event object through the window object.

This object in Microsoft ® Internet Explorer 4.0 is available in the script.

Example

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

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

For each property or method Event object can be achieved, should be chosen above IE5.5 version.

相关文章
  • The event object Javascript 2010-12-08

    Javascript, Javascript Event object is used to describe the events, it IE4 and NN4 major role in future versions of each browser. Event status on behalf of the event, such as the elements of the incident, keyboard status, the mouse position and mouse

  • Detailed analysis in the window.event object JavaScript 2010-10-09

    event on behalf of the state of the incident, for example, the elements of the trigger event object, the location and status of the mouse, press the button and so on. event object is only in the course of events to be effective. event of certain prop

  • javascript Event object Xiangjie 2010-03-25

    Reprint: javascript Event object Xiangjie Event status on behalf of the event, such as elements of the incident, keyboard status, the mouse position and mouse button state. Once the event occurs, it will generate Event objects, such as the click of a

  • JavaScript event event object properties 2010-09-25

    IE and FF for the different events: var e = window.event | | e.target; / / event object only in the course of events to be effective. Property Description clientX / clientY return to the mouse in the window client area in the x / y coordinates. offse

  • Get the whole family event object 2010-04-23

    Simple object access events, a long time ago, we knew the event object in IE as a global object (window.event) exists, Firefox is used as a handle in the (handler) the first argument to the. So a line of code can handle, such as: var evt = window.eve

  • Event listener. Remove and event object analysis 2010-06-13

    Javascript event handling model is based on a different browser and differ mainly in two ways: 1.Firefox, Chrome, Safira support the DOM Level 2 event model; 2.IE own event processing model. The DOM Level 0 is that all browsers support the event mech

  • The event.srcElement and event.target javascript 2010-06-23

    Javascript event.srcElement can capture the role of the current event object, such as event.srcElement.tagName can capture the current access to the tag name, pay attention to get the tag names are in upper case, said as "TD" "TR" &quo

  • window window object - Javascript language to describe 2010-11-09

    window Window object - Javascript language to describe --------------------------------------------------------------------- Note : Attribute on the element name and the page JavaScript Name of reference must be the same, including case Otherwise, yo

  • Event event object event listener 2010-03-28

    Event flow: Bubble-type event refers to an event will trigger a series of up to trigger the same events all the bubbling from the bottom up <body> <div> <p> click ......</ p> </ Div> </ Body> If a click event to trigger

  • window.event object details 2010-05-30

    1, event on behalf of the state of events, such as trigger event object element, the location and status of the mouse, press the button and so on. event object only in the course of events to be effective. event of certain attributes only makes sense

  • Reading Ext of eight (packaging native event object) 2010-11-27

    Ext library is also the native browser event object to do the packaging, to ensure compatibility with all browsers. Here are the native browser event object of the browser compatibility. Here are a variety of situations to get the event object. Event

  • Read jq of eight (original repair and expansion of the event object) 2010-12-04

    Since all the native browser event object differences, most JS libraries / frameworks are more or less of the original event object for the repair and expansion. For example, use IE to stop the event bubbling cancelBubble , standard browser is used s

  • JAVASCRIPT common event. Object access techniques 2010-06-22

    JAVASCRIPT common events, objects, access to skills Event source object event.srcElement.tagName event.srcElement.type Capture Release event.srcElement.setCapture (); event.srcElement.releaseCapture (); Events button event.keyCode event.shiftKey even

  • JSF 2 Introduction, Part 3: Event handling. JavaScript and Ajax 2010-09-11

    (Transfer from: http://www.ibm.com/developerworks/cn/java/j-jsf2fu3/ ) August 3, 2009 Java ™ Server Faces (JSF) 2 members of the Group in this period David Geary to the end of this article in the JSF 2 new features of the series (3 parts) . This arti

  • Get event. Object. Attribute 2010-09-15

    <a href='http://google.com'> click me. </ a> $ (Function () ( $ ("A"). Click (function (event) ( alert (event.type); / / Get the event type return false; / / stop link Jump )); )) / / Run Results: Display click Capture the object usi

  • Enter the event using javascript keyboard controls 2010-10-27

    <SCRIPT function _saveInfo () { / / Write the event you need alert ("Enter the carriage return on your keyboard!"); } function document_onkeypress () { switch (event.keyCode) { case 13: _saveInfo ();// capture carriage returns } } </ SCRIP

  • IE事件对象(The Internet Explorer Event Object) 2014-09-08

    不同于DOM事件对象,基于Event Handler授权这种方式,IE事件对象可以用不同的方式进行访问.当一个事件Handler通过DOM 0 级的方式被授权,则这个事件对象将作为window对象的属性而存在 看下面的例子, var btn = document.getElementById('mybtn'); btn.onclick = function(){ var event = window.event; alert(event.type);//"click" } 此时,eve

  • the definition of class or object javascript 2010-04-18

    1. Plant way function createObj(sColor,iSize){ var oTempObj = new Object; oTempObj.color = sColor; oTempObj.size = iSize; oTempObj.tellSize = function () { alert(this.color) }; return oTempObj; } var oObj1 = createObj("red",10); var oObj2 = crea

  • several ways to create object javascript 2010-11-16

    1. create function function Pet(the_pet_name, the_form_number){ this.age = 0; this.pet_name = the_pet_name; this.form_number = the_form_number; } 2. Ways to create JSON var o={ a:1, b:"aa", c:function(){alert("haiwei o");} } 3. Using t

  • event Object Reference Manual 2009-12-01

    http://www.w3school.com.cn/htmldom/dom_obj_event.asp