打印版式

Class Ext.EventObject

Package:Ext
Class:EventObject
Extends:Object
Defined In:EventManager.js
EventObject exposes the Yahoo! UI Event functionality directly on the object passed to your event handler. It exists mostly for convenience. It also fixes the annoying null checks automatically to cleanup your code Example:
function handleClick(e){ // e is not a standard event object, it is a Ext.EventObject
    e.preventDefault();
    var target = e.getTarget();
    ...
 }
 var myDiv = Ext.get("myDiv");
 myDiv.on("click", handleClick);
 //or
 Ext.EventManager.on("myDiv", 'click', handleClick);
 Ext.EventManager.addListener("myDiv", 'click', handleClick);


This class is a singleton and cannot be created directly.

属性   -  方法   -  事件

公共属性

属性 定义对象
  BACKSPACE : Number EventObject
Key constant
  CONTROL : Number EventObject
Key constant
  DELETE : Number EventObject
Key constant
  DOWN : Number EventObject
Key constant
  END : Number EventObject
Key constant
  ENTER : Number EventObject
Key constant
  ESC : Number EventObject
Key constant
  F5 : Number EventObject
Key constant
  HOME : Number EventObject
Key constant
  LEFT : Number EventObject
Key constant
  PAGEDOWN : Number EventObject
Key constant
  PAGEUP : Number EventObject
Key constant
  RETURN : Number EventObject
Key constant
  RIGHT : Number EventObject
Key constant
  SHIFT : Number EventObject
Key constant
  SPACE : Number EventObject
Key constant
  TAB : Number EventObject
Key constant
  UP : Number EventObject
Key constant
  altKey : Object EventObject
True if the alt key was down during the event
  browserEvent : Object EventObject
The normal browser event
  button : Object EventObject
The button pressed in a mouse event
  ctrlKey : Object EventObject
True if the control key was down during the event
  shiftKey : Object EventObject
True if the shift key was down during the event

公共方法

方法 定义对象
  getCharCode() : Number EventObject
Gets the key code for the event.
  getKey() : Number EventObject
Returns a normalized keyCode for the event.
  getPageX() : Number EventObject
Gets the x coordinate of the event.
  getPageY() : Number EventObject
Gets the y coordinate of the event.
  getRelatedTarget() : HTMLElement EventObject
Gets the related target.
  getTarget([String selector], [Number/String/HTMLElement/Element maxDepth], [Boolean returnEl]) : HTMLelement EventObject
Gets the target for the event.
  getTime() : Number EventObject
Gets the time of the event.
  getWheelDelta() : Number EventObject
Normalizes mouse wheel delta across browsers
  getXY() : Array EventObject
Gets the page coordinates of the event.
  hasModifier() : Boolean EventObject
Returns true if the control, meta, shift or alt key was pressed during this event.
  preventDefault() : void EventObject
Prevents the browsers default handling of the event.
  stopEvent() : void EventObject
Stop the event (preventDefault and stopPropagation)
  stopPropagation() : void EventObject
Cancels bubbling of the event.
  within(String/HTMLElement/Element el, [Boolean related]) : Boolean EventObject
Returns true if the target of this event equals el or is a child of el

公共事件

此类没有公共事件。

属性详情

BACKSPACE

public Number BACKSPACE
Key constant
This property is defined by EventObject.

CONTROL

public Number CONTROL
Key constant
This property is defined by EventObject.

DELETE

public Number DELETE
Key constant
This property is defined by EventObject.

DOWN

public Number DOWN
Key constant
This property is defined by EventObject.

END

public Number END
Key constant
This property is defined by EventObject.

ENTER

public Number ENTER
Key constant
This property is defined by EventObject.

ESC

public Number ESC
Key constant
This property is defined by EventObject.

F5

public Number F5
Key constant
This property is defined by EventObject.

HOME

public Number HOME
Key constant
This property is defined by EventObject.

LEFT

public Number LEFT
Key constant
This property is defined by EventObject.

PAGEDOWN

public Number PAGEDOWN
Key constant
This property is defined by EventObject.

PAGEUP

public Number PAGEUP
Key constant
This property is defined by EventObject.

RETURN

public Number RETURN
Key constant
This property is defined by EventObject.

RIGHT

public Number RIGHT
Key constant
This property is defined by EventObject.

SHIFT

public Number SHIFT
Key constant
This property is defined by EventObject.

SPACE

public Number SPACE
Key constant
This property is defined by EventObject.

TAB

public Number TAB
Key constant
This property is defined by EventObject.

UP

public Number UP
Key constant
This property is defined by EventObject.

altKey

public Object altKey
True if the alt key was down during the event
This property is defined by EventObject.

browserEvent

public Object browserEvent
The normal browser event
This property is defined by EventObject.

button

public Object button
The button pressed in a mouse event
This property is defined by EventObject.

ctrlKey

public Object ctrlKey
True if the control key was down during the event
This property is defined by EventObject.

shiftKey

public Object shiftKey
True if the shift key was down during the event
This property is defined by EventObject.

方法详情

getCharCode

public function getCharCode()
Gets the key code for the event.
参数:
  • 无。
返回:
  • Number
This method is defined by EventObject.

getKey

public function getKey()
Returns a normalized keyCode for the event.
参数:
  • 无。
返回:
  • Number
    The key code
This method is defined by EventObject.

getPageX

public function getPageX()
Gets the x coordinate of the event.
参数:
  • 无。
返回:
  • Number
This method is defined by EventObject.

getPageY

public function getPageY()
Gets the y coordinate of the event.
参数:
  • 无。
返回:
  • Number
This method is defined by EventObject.

getRelatedTarget

public function getRelatedTarget()
Gets the related target.
参数:
  • 无。
返回:
  • HTMLElement
This method is defined by EventObject.

getTarget

public function getTarget([String selector], [Number/String/HTMLElement/Element maxDepth], [Boolean returnEl])
Gets the target for the event.
参数:
  • selector : String
    (可选) A simple selector to filter the target or look for an ancestor of the target
  • maxDepth : Number/String/HTMLElement/Element
    (可选) The max depth to search as a number or element (defaults to 10 || document.body)
  • returnEl : Boolean
    (可选) True to return a Ext.Element object instead of DOM node
返回:
  • HTMLelement
This method is defined by EventObject.

getTime

public function getTime()
Gets the time of the event.
参数:
  • 无。
返回:
  • Number
This method is defined by EventObject.

getWheelDelta

public function getWheelDelta()
Normalizes mouse wheel delta across browsers
参数:
  • 无。
返回:
  • Number
    The delta
This method is defined by EventObject.

getXY

public function getXY()
Gets the page coordinates of the event.
参数:
  • 无。
返回:
  • Array
    The xy values like [x, y]
This method is defined by EventObject.

hasModifier

public function hasModifier()
Returns true if the control, meta, shift or alt key was pressed during this event.
参数:
  • 无。
返回:
  • Boolean
This method is defined by EventObject.

preventDefault

public function preventDefault()
Prevents the browsers default handling of the event.
参数:
  • 无。
返回:
  • void
This method is defined by EventObject.

stopEvent

public function stopEvent()
Stop the event (preventDefault and stopPropagation)
参数:
  • 无。
返回:
  • void
This method is defined by EventObject.

stopPropagation

public function stopPropagation()
Cancels bubbling of the event.
参数:
  • 无。
返回:
  • void
This method is defined by EventObject.

within

public function within(String/HTMLElement/Element el, [Boolean related])
Returns true if the target of this event equals el or is a child of el
参数:
  • el : String/HTMLElement/Element
  • related : Boolean
    (可选) true to test if the related target is within el instead of the target
返回:
  • Boolean
This method is defined by EventObject.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.