how about
:
function addEvent(obj, type, fn){
if (obj.attachEvent){
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn](window.event);}
obj.attachEvent('on'+type, obj[type+fn]);
}else
obj.addEventListener(type, fn, false);
}
var a = document.getElementById("myaID");
addEvent(a, "click", function(){alert(this.href)});
<so*********@gmail.com> schreef in bericht
news:11**********************@h76g2000cwa.googlegr oups.com...
BTW, the above code works in FireFox, but not in IE
so*********@gmail.com wrote: thanks for reply.
what I am doing is
// a is a link object
AddEventHandler(a, "click", specialExecution);
function specialExecution()
{
// if I alert(this); it shows [object]
// but if I do the following
var url = this.href;
// it is undefined
alert(url);
}