소프트웨어/JavaScript • Dhtml

IE/FF(Gecko,W3C) 이벤트 설명

falconer 2007. 4. 13. 07:48
링크
IE와 FF에서의 이벤트 처리에 대한 설명을 정리해봤습니다. 틀린게 있을 수도 있습니다. 모질라 DOM레퍼런스에도 없는게 있어서, 그런 설명이 없을 수도 있습니다. 제가 쓸 일이 없다고 생각한건, 대충 설명되어잇을 수 있습니다.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

IE/FF(Gecko,W3C) 이벤트 설명

IE와 FF에서 이밴트를 불러 사용하는 방법(예제)
브라우저 IE FF IE&FF
input 개체 <input onclick="fn()"> <input onclick="fn(event)"> <input onclick="fn(event)">
함수

function fn(){
alert(event.type);
}

function fn(e){
alert(e.type);
}
function fn(e){
var evt = window.event || e;
alert(evt.type);
}

설명
(예제 값은 <input> 에서 onclick 이벤트로 발생시킴)

설명 순서는 내 마음대로, 관계있는 것 끼리 엮음.
해석하기 어렵거나 이해하기 어려운건 원문과 같이 나타냈습니다.
IE value FF value 특징 설명
기능키
altKey FALSE altKey FALSE 읽기전용 키보드 ALT키가 눌러져있는가?
altLeft FALSE     읽기전용 왼쪽 ALT키가 눌러져있는가?
ctrlKey FALSE ctrlKey FALSE 읽기전용 키보드 Ctrl 키가 눌러져있는기?
ctrlLeft FALSE     읽기전용 키보드 왼쪽 Ctrl키가 눌러져있는가?
shiftKey FALSE shiftKey FALSE 읽기전용 Shift 키가 눌러져있는가?
shiftLeft FALSE     읽기전용 왼쪽 Shift 키가 눌러져있는가?
키보드/마우스
keyCode 0     읽기전용 현재 발생된 키코드(키보드에서 눌려진 키의 10진수 값)
    which 1 읽기전용 현재 발생된 키코드(키보드에서 눌려진 키의 10진수 값) & 마우스 동작
1:왼쪽마우스,2:가운데마우스,3:왼쪽마우스, 나머지값:키의 ASCII 값
    detail 1 읽기전용 click, dblclick, mousedown, or mouseup 이벤트에서만 발생, 마우스가 클릭 수를 표시, dblclick는 항상 2
  isChar FALSE 읽기전용 Returns a boolean indicating whether the event produced a key character or not.
입력된 값이 글자인지 체크
button 0 button 0 읽기전용 현재 눌려진 마우스 버튼(IE)
onmousedown, onmouseup, onmousemove 이벤트에서만 발생
(onClick에서는 0)
  IE
0 Default. No button is pressed.
1 Left button is pressed.
2 Right button is pressed.
3 Left and right buttons are both pressed.
4 Middle button is pressed.
5 Left and middle buttons both are pressed.
6 Right and middle buttons are both pressed.
7 All three buttons are pressed.

  FF  
0 for standard 'click', usually left button  
1 for middle button, usually wheel-click
 
2 for right button, usually right-click  
wheelDelta 0     읽기전용 마우스 휠의 이동량
type click type click 읽기전용 현재 발생된 이벤트 타입
    timeStamp 4108593 읽기전용 이밴트가 생성된 시간(유닉스타임)
    view [object Window] 읽기전용 The view attribute identifies the AbstractView from which the event was generated.
    metaKey FALSE   Used to indicate whether the 'meta' key was depressed during the firing of the event. On some platforms this key may map to an alternative key name.
repeat FALSE       Retrieves whether the onkeydown event is being repeated.
onkeydown이벤트에서 키입력의 반복을 허용하는가?
X/Y좌표
clientX 552 clientX 25 읽기전용 이벤트가 발생한 X위치(현재 페이지 기준)
clientY 188 clientY 392 읽기전용 이벤트가 발생한 Y위치(현재 페이지 기준)
offsetX 537     읽기전용 이벤트가 발생된 대상에서의 이벤트 발생 위치 X값
offsetY -107     읽기전용 이벤트가 발생된 대상에서의 이벤트 발생 위치 Y값
screenX 754     읽기전용 window.screen 에서 상대적 위치 X값
screenY 285     읽기전용 window.screen 에서 상대적 위치 Y값
x 552     읽기전용 현재 보이는 페이지에서의 상대적 위치 X값(스크롤 값을 계산되지 않는다)
y 188     읽기전용 현재 보이는 페이지에서의 상대적 위치 Y값(스크롤 값을 계산되지 않는다)
    layerX 26 읽기전용 Returns the horizontal coordinate of the event relative to the current layer.
레이어에서의 상대적 위치 X값
    layerY 393 읽기전용 Returns the vertical coordinate of the event relative to the current layer.
레이어에서의 상대적 위치 Y값
    pageX 25 읽기전용 Returns the horizontal coordinate of the event relative to the page.
    pageY 392 읽기전용 Returns the vertical coorindate of the event relative to the page.
이밴트 대상
fromElement null     읽기전용 이벤트가 발생된 개체(이밴트가 진행중일 때)
srcElement [object] currentTarget [object HTMLInputElement] 읽기전용 현재 이벤트가 발생된 개체
  eventPhase 2 읽기전용 Indicates which phase of the event flow is currently being evaluated.
  explicitOriginalTarget [object HTMLInputElement] 읽기전용 The explicit original target of the event. (Mozilla-specific)
toElement null     읽기전용 Sets or retrieves a reference to the object toward which the user is moving the mouse pointer.
사용자에 의한 마우스 이동으로 지못된 개체를 참조
    originalTarget [object HTMLInputElement] 읽기전용 The original target of the event, before any retargetings (Mozilla-specific).
    relatedTarget null 읽기전용 Identifies a secondary target for the event.
이벤트에 영향을 받은 2번째 대상
    target [object HTMLInputElement] 읽기전용 Returns a reference to the target to which the event was originally dispatched.
이밴트가 발생된 대상을 참조
propertyName         이벤트의 발생으로 변경되는 프로퍼티의 이름
(ex> textbox에 키가 입력되면 value 값을 가지게된다)
이밴트버블
cancelBubble FALSE cancelBubble FALSE   이벤트가 다음 이벤트처리자에 연결되는지 처리
(false:허용됨(기본값)/true:허용안됨(현재에서 이벤트는 정지))
    bubbles TRUE 읽기전용 이벤트가 버블링 되는지 표시
    cancelable TRUE 읽기전용 이벤트를 멈출 수 있는가를 표시
returnValue undefined       Sets or retrieves the return value from the event.
이벤트가 반환되는가?
true(기본) : 이 이벤트는 다른 곳에 반환된다.(이벤트가 계속)
false : 이 이벤트는 이곳에서 끝난다(이벤트가 취소)
DB관련
bookmarks null       Returns a collection of Microsoft ActiveX Data Objects (ADO) bookmarks tied to the rows affected by the current event.
(개체에 연결된 DB내역(rows)참조)
boundElements [object]       Returns a collection of all elements on the page bound to a data set.
(개체에 연결된 DB 데이터(Data Set) 참조)
dataFld       읽기전용 Sets or retrieves the data column affected by the oncellchange event.
oncellchange 이벤트로 영형을 받은 데이터 Column
dataTransfer null     Object Provides access to predefined clipboard formats for use in drag-and-drop operations.
드래그앤드롭의 동작은 제어
qualifier       Sets or retrieves the name of the data member provided by a data source object(DSO).
reason 0       Sets or retrieves the result of the data transfer for a data source object(DSO).
recordset null       Sets or retrieves from a data source object a reference to the default record set.
         
기타
  isTrusted TRUE    
    rangeOffset 0    
    rangeParent [object Text]    
nextPage     IE5.5+ nextPage 속성값은 인쇄나 인쇄 템플릿에서 다음 페이지의 위치를 나타내는 문자열이다.
contentOverflow FALSE     읽기전용 Retrieves a value that indicates whether the document contains additional content after processing the current LayoutRect object.
srcFilter null     읽기전용

onfilterchange 이벤트를 발생시킨 Filter

srcUrn       읽기전용 Retrieves the Uniform Resource Name (URN) of the behavior that fired the event.
이벤트를 발생시킨 behavior 의 주소(URN)
behaviorCookie 0       일반 HTML에 사용되지 않는다.
behaviorPart 0       일반 HTML에 사용되지 않는다.
           
FF이벤트의 메소드
    stopPropagation function stopPropagation() {[native code]}   Stops the propagation of events further along in the DOM.
이밴트의 번짐을 취소시킨다.
    getPreventDefault function getPreventDefault() {[native code]}    
    initEvent

function initEvent(){[native code]}

  Initializes the value of an Event created through the DocumentEvent interface.
이밴트가 만들어질 때 초기화 하는 메소드
    initMouseEvent function initMouseEvent() {[native code]}   Initializes a mouse event once it's been created
마우스 이밴트가 만들어 질 때 초기화 하는 메소드
    initUIEvent function initUIEvent() {[native code]}  

Initializes a UI event once it's been created
UI이벤트가 생성될 초기화 하는 메소드

    preventBubble function preventBubble() {[native code]}   Prevents the event from bubbling. This method is deprecated in favor of standard stopPropagation and is removed in Gecko
    preventCapture function preventCapture() {[native code]}   This method is deprecated in favor of standard stopPropagation and is removed in Gecko 1.9.
    preventDefault function preventDefault() {[native code]}   Cancels the event (if it is cancelable).
이밴트를 취소한다.

참고 사이트
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_event.asp
http://developer.mozilla.org/en/docs/DOM:event
http://koxo.com/
 
-만든이: 공대여자, mins01
http://mins01.zerock.net
mins01(at)lycos.co.kr