L
Luke Matuszewski
Why window.onclick isn't fired in IE and is fired on Gecko agents ?
<html onclick="alert('Event is now at the HTML element.')">
<head>
<title>Event Bubbles</title>
<script type="text/javascript">
function init() {
document.onclick = docEvent;
window.onclick = winEvent
document.body.onclick = docBodEvent;
alert(document == window);
}
function winEvent() {
alert("Event is now at the window object level.");
}
function docEvent() {
alert("Event is now at the document object level.");
}
function docBodEvent() {
alert("Event is now at the BODY element.");
}
</script>
</head>
<body onload="init()">
<h1>Event Bubbles</h1>
<hr />
<form onclick="alert('Event is now at the FORM element.')">
<input type="button" value="Button 'main1'" name="main1"
onclick="alert('Event started at Button: ' + this.name)" />
</form>
</body>
</html>
<html onclick="alert('Event is now at the HTML element.')">
<head>
<title>Event Bubbles</title>
<script type="text/javascript">
function init() {
document.onclick = docEvent;
window.onclick = winEvent
document.body.onclick = docBodEvent;
alert(document == window);
}
function winEvent() {
alert("Event is now at the window object level.");
}
function docEvent() {
alert("Event is now at the document object level.");
}
function docBodEvent() {
alert("Event is now at the BODY element.");
}
</script>
</head>
<body onload="init()">
<h1>Event Bubbles</h1>
<hr />
<form onclick="alert('Event is now at the FORM element.')">
<input type="button" value="Button 'main1'" name="main1"
onclick="alert('Event started at Button: ' + this.name)" />
</form>
</body>
</html>