D
dave
What I am attempting to do is cancel an event in IE inside of my event
handler, but the handler keeps getting called:
for example if I do
<div id="foo">
<div id="test">test text</div>
</div>
and assign an event by doing:
document.attachEvent("onclick",functionName)
IE seems to be firing the event twice. Is there a way to stop it?
the function looks like:
function functionName(e){
if (!e) e = window.event; // IE event model
//do something then:
if (e.stopPropagation) e.stopPropagation(); // DOM Level 2
else e.cancelBubble = true; // IE
}
// Now prevent any default action.
if (event.preventDefault) event.preventDefault(); // DOM Level
2
else event.returnValue = false;
}
handler, but the handler keeps getting called:
for example if I do
<div id="foo">
<div id="test">test text</div>
</div>
and assign an event by doing:
document.attachEvent("onclick",functionName)
IE seems to be firing the event twice. Is there a way to stop it?
the function looks like:
function functionName(e){
if (!e) e = window.event; // IE event model
//do something then:
if (e.stopPropagation) e.stopPropagation(); // DOM Level 2
else e.cancelBubble = true; // IE
}
// Now prevent any default action.
if (event.preventDefault) event.preventDefault(); // DOM Level
2
else event.returnValue = false;
}