P
Pavils Jurjans
Hello,
Here's the code I am testing with:
// ******************************************************
<html>
<head>
<title> IE6 loosing onclick event </title>
<script>
function bodyClick() {
document.f.trace.value = new Date() + '';
}
function testFn() {
var testTag = document.getElementById("testArea");
testTag.innerHTML = '<div style="background-color:Red"
onclick="testFn()">'+(new Date())+'</div>';
}
</script>
</head>
<body onclick="bodyClick()">
<form name="f">
<input type="text" name="trace" value=""/>
<span id="testArea">
<div style="background-color:Red" onclick="testFn()">Click
here</div>
</span>
</form>
</body>
</html>
// ******************************************************
Although body has onclick handler, it is not triggered when clicked on
the red area. This happens only in cases when the HTML that contains
tag with the onclick attribute which received the event, is overwriten
with a new value. Something like pulling the carpet out from ones
feet. This is not actually the expected behaviour. Why shouldn't the
document element receive onclick event anyway? This mishap causes some
bad things in my DHTML application, where it is assumed that any click
on the document area (except on ActiveX controls/java applets) is
handled by document.onclick handler.
Since this happens on both IE6 and Firebird (0.7), I guess this is
by-design, but it actually escapes me why. Perhaps somebody has better
idea?
Pavils
Here's the code I am testing with:
// ******************************************************
<html>
<head>
<title> IE6 loosing onclick event </title>
<script>
function bodyClick() {
document.f.trace.value = new Date() + '';
}
function testFn() {
var testTag = document.getElementById("testArea");
testTag.innerHTML = '<div style="background-color:Red"
onclick="testFn()">'+(new Date())+'</div>';
}
</script>
</head>
<body onclick="bodyClick()">
<form name="f">
<input type="text" name="trace" value=""/>
<span id="testArea">
<div style="background-color:Red" onclick="testFn()">Click
here</div>
</span>
</form>
</body>
</html>
// ******************************************************
Although body has onclick handler, it is not triggered when clicked on
the red area. This happens only in cases when the HTML that contains
tag with the onclick attribute which received the event, is overwriten
with a new value. Something like pulling the carpet out from ones
feet. This is not actually the expected behaviour. Why shouldn't the
document element receive onclick event anyway? This mishap causes some
bad things in my DHTML application, where it is assumed that any click
on the document area (except on ActiveX controls/java applets) is
handled by document.onclick handler.
Since this happens on both IE6 and Firebird (0.7), I guess this is
by-design, but it actually escapes me why. Perhaps somebody has better
idea?
Pavils