You cannot get an item with a click in the URL javascript:. The event has already ended, so no event.target(or window.event.srcElementfor IE), and javascript:links are not called using thisset (so you get window).
Of course, if you know that this link matters id="test", you can do it document.getElementById('test'), but I suspect you are missing the point of what you want to do.
href. onclick, lib.
lib. javascript: URL- - , .
<script> ? , click () . :.
for (var i= document.links.length; i-->0;)
if (document.links[i] is one of the links you want to target)
document.links[i].onclick= someHandlerFunction;
function someHandlerFunction() {
alert(this);
return false;
}
, JS ( on... addEventListener attachEvent IE) .