Mam przykładowy kod:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <script type="text/javascript"> function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent) { var r = elm.attachEvent('on' + evType, fn); return r; } else { elm['on' + evType] = fn; } } function test1(e) { alert("test1"); } function test2(e) { alert(e.target); } var head = document.getElementById('head'); addEvent(head, 'click', test1, false); addEvent(head, 'click', test2, false); </script> </body> </html>
Wszystko działa pięknie, ale pod Operą i FF. Na IE SP2 wywala mi ostrzeżenie o naruszeniu zabezpieczeń :| WTF? Da się to jakoś obejść?
Screen:
http://img28.imageshack.us/my.php?image=be...wy1kopia1to.png