Bazi Eventlarin Browser Uyumluluk Tablosu
Event compatibility tables
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
---|---|---|---|---|---|---|---|
blur, focus
The blur event fires when an element loses focus.The focus event fires when an element gains focus. On a window, these events usually also fire when the window loses or gains focus because another element like a form field or a link gains or loses focus. If the user clicks on a link, the link gains the focus and keeps it until another element gains the focus. Curiously, W3C has never recognized the existence of these events on windows. |
Test page window | ||||||
Yes | Yes | Yes | Buggy | Yes | Yes | Yes | |
window.onfocus = doSomething;
|
|||||||
Test page Link element | |||||||
Yes | Yes | Incom |
Incom |
Incom |
Incom |
No | |
document.links[0].onblur = doSomething; A perfect implementation would allow focusing and blurring both by a click on the link and by TABbing to the link. Opera only supports the click; Mozilla, Safari and Explorer Mac only the TAB. Note that in Safari you explicitly have to switch on tabbing to links in the Advanced preferences panel. |
|||||||
Test page Form fields | |||||||
Yes | Yes | Yes | Yes | Incom |
Yes | Yes | |
document.forms[0].elements[1].onblur = doSomething;
|
|||||||
contextmenu
The contextmenu event fires whenever the user calls up a context menu. |
Test page document | ||||||
Yes | Yes | No | Yes | Yes | No | No | |
document.oncontextmenu = doSomething; | |||||||
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
load
The load event fires when an HTML document has been loaded completely, including all images, and arrays such as document. have been initialized. You should run your own initializing scripts onload . |
Test page window | ||||||
Yes | Yes | Yes | Yes | Yes | Minimal and alter |
Yes | |
window.onload = doSomething;
|
|||||||
resize
The resize event fires while the user resizes the browser window. A major resize job causes the event to fire many times over |
Test page window | ||||||
Yes | Yes | Yes | Alter |
Yes | Yes | Buggy until 4.5 | |
window.onresize = doSomething;
|
|||||||
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
scroll
The scroll event fires when the user scrolls a page, a frame or an element with overflow: auto in any way supported by the browser: by using the scrollbar, the arrow keys or the mouse wheel. |
Test page window | ||||||
Yes | Yes | Yes | Minimal | Yes | Yes | No | |
window.onscroll = doSomething;
|
|||||||
Test page element with overflow: auto |
|||||||
Yes | Yes | Yes | Yes | Yes | No | Untest |
|
x.onscroll = doSomething; where x is an element with overflow: auto
|
|||||||
unload
The unload event fires whenever the page is unloaded for whatever reason.It is not possible to distinguish between the user going to another page and the user closing the entire window, the unload event always fires. It is also not possible to cancel the unloading of the page. |
Test page window | ||||||
Yes | Yes | Yes | Yes | Yes | Minimal | Yes | |
window.onunload = doSomething;
|
Mouse events
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
---|---|---|---|---|---|---|---|
click
The click event fires after one mousedown and one mouseup event have taken place on the same element. Correct order:
On links the event should also fire when the user tabs to the links and then hits Enter. |
Test page document | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.onclick = doSomething; | |||||||
Test page Link elements | |||||||
Yes | Yes | Incom |
Yes | Yes | Yes | Yes | |
document.links[0].onclick = doSomething;
|
|||||||
Test page Any other element | |||||||
Yes | Yes | Yes | Yes | Yes | Yes | Incom |
|
x.onclick = doSomething; where x is any HTML element
|
|||||||
Test page Form fields | |||||||
Yes | Yes | Incom |
Yes | Almost | Yes | Incom |
|
document.forms[0].elements[1].onclick = doSomething;
|
|||||||
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
dblclick
The dblclick event fires after the user has clicked twice in rapid succesion on the same element. All browsers support it.The incompatibilities are in the succession of events leading up to the dblclick. Every browser uses a different event order. In practice it is not possible to use both the click and dblclick events on the same element. The browsers aren't sufficiently able to distinguish between them. |
Test page Link element | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.links[0].ondblclick = doSomething; The order of events leading up to the dblclick:
|
|||||||
Test page Any element | |||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
x.ondblclick = doSomething; where x is any HTML element
|
|||||||
mousedown, mouseup
The mousedown event fires when the user depresses the mouse button.The mouseup event fires when the user releases the mouse button. If these two events take place on the same element, a click event fires. |
Test page document | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.links[0].onmousedown = doSomething; | |||||||
Test page Link element | |||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.links[0].onmousedown = doSomething; | |||||||
Test page Any element | |||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
x.onmousedown = doSomething; where x is any HTML element
|
|||||||
mouseenter, mouseleave
The mouseenter and mouseleave events are subtly different from mouseover and mouseout. See the Mouse events page for an explanation of the differences.mouseenter fires after mouseover, mouseleave before mouseout. |
Test page Link element | ||||||
5.5 | Yes | No | No | No | No | No | |
document.links[0].onmouseenter = doSomething; | |||||||
Test page Any element | |||||||
5.5 | Yes | No | No | No | No | No | |
x.onmouseleave = doSomething; where x is any HTML element I must admit I expected support by some minor browser when I included these Microsoft events in the test program. |
|||||||
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
mousemove
The mousemove event fires whenever the user moves the mouse. It continues firing as long as the mouse moves. |
Test page document | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.onmousemove = doSomething;
|
|||||||
Test page Any element | |||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
x.onmousemove = doSomething; where x is any HTML element
|
|||||||
mouseover, mouseout
The mouseover event fires when the mouse enters the area of the element. The mouseout event fires when the mouse leaves the area again. |
Test page Link element | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.links[0].onmouseover = doSomething; | |||||||
Test page Any element | |||||||
Yes | Yes | Yes | Yes | Buggy | Yes | Yes | |
x.onmouseout = doSomething; where x is any HTML element
|
Form events
See also the key to my compatibility tables.
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
---|---|---|---|---|---|---|---|
change
The change event should fire immediately after any form element changes its state. Text fields fire the event onblur when their content has changed. Selects fire the event onclick at the moment of option selection. Checkboxes and radio buttons should fire the event onclick |
Test page Form fields | ||||||
Almost | Almost | Almost | Yes | Incom |
Incom |
Incom |
|
document.forms[0].elements[1].onchange = doSomething;
|
|||||||
reset
The reset event fires when the user resets the form. |
Test page Form element | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.forms[0].onreset = doSomething; | |||||||
select
The select event fires when the user has selected text in a text field. It should fire onmouseup, when the user finishes selecting. |
Test page Form fields | ||||||
Alter |
Alter |
Yes | Yes | No | Yes | No | |
document.forms[0].elements[1].onselect = doSomething;
|
|||||||
submit
The submit event fires when the user submits the form. It does not fire when a script submits the form (document.forms[0]. ). |
Test page Form element | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.forms[0].onsubmit = doSomething; |
Key events
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
---|---|---|---|---|---|---|---|
keydown, keypress, keyup
keydown and keypress keep firing continuously as long as the user keeps a key depressed. keyup fires once when the user releases the key.In Netscape 4 the keydown event fires only once, when the user initially depresses the key. In all other browsers there is no difference between keydown and keypress. |
Test page Document | ||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.onkeydown = doSomething; | |||||||
Test page Form fields | |||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
document.forms[0].elements[1].onkeydown = doSomething; Support on text fields is enough to merit a Yes. If you want to prevent the default action (ie: prevent the character from being inserted), you must use the keypress event. |
Miscellaneous events
abort
The abort event fires when the user aborts the loading of images or the page. |
It's very hard to create tests for the abort event. I'd need a test file of 12.5 Meg, to make sure that even on a fast 10 Mb/sec connection the user of the test has about 10 seconds to realize that to test the abort event he should stop the downloading and then to actually do it. Besides the event is completely useless. I never needed it myself, nor did I ever encounter any site that uses it. Just forget abort. |
||||||
Event | Explorer 5 Windows | Explorer 6 Windows | Explorer 5.2 Mac | Mozilla 1.75 | Safari 1.3 | Opera 8 | Netscape 4 |
---|---|---|---|---|---|---|---|
error
The error event fires when a JavaScript error has occurred (window) or when a image cannot be found (img elements). |
Test page window | ||||||
? | ? | ? | ? | ? | ? | ||
window.onerror = doSomething; The event test now fails in all browsers on all levels. That's odd, because I'm pretty sure it used to work. |
|||||||
Test page Image element | |||||||
Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
<img src="404.gif" onerror="doSomething()"> It's best to use inline event registration for this event because the error event may fire before the page has completely loaded, in which case an event handler registered onload wouldn't capture it. |
|||||||
DOMSubtreeModified
The DOMSubtreeModified event of an element fires whenever any change occurs in the node tree of the descendants of the element. |
Test page Any element | ||||||
No | No | No | No | No | No | No | |
x.addEventListener('DOMSubtreeModified',doSomething,false); where x is any HTML element This is the most general of W3C's DOM events, and the only one I test for now. Note that the use of the W3C event registration model is required. |
Kaynak www.quirksmode.org/js/events_compinfo.html
Yorumunuzu Ekleyin