Robin Rattay wrote:
With the DOM API events are set either directly:
document.getElementById('Button1').onclick = function() { ... }
or with addEventListener:
document.getElementById('Button1').addEventListene r("click",
function() { ... }, true);
Reference Worms[tm] are error-prone, and should therefore be avoided.
// add feature tests here
var o = document.getElementById('Button1');
if (o)
{
// add feature tests here
o.addEventListener("click", function() { ... }, true)
}
Adding a capturing event listener (`true') through the standards-compliant
addEventListener() method of the EventTarget interface is _not_ equivalent
to assigning to the proprietary event handler property (`on...').
Therefore, the third argument should be `false' unless compatibility with
non-DOM2 UAs is not an issue (seldom).
Which IE however doesn't support. You need to use attachEvent for IE.
However, IE/MSHTML does support the proprietary event handler property,
which should to be used instead of attachEvent():
http://www.quirksmode.org/blog/archi...nt_consid.html
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee