Original code:
function registerHandlers() { var as = document.getElementsByTagName('a'); for (var i = 0; i < as.length; i++) { as[i].onclick = function() { alert(i); return false; } } } /* HTML code for testing purposes (do not submit uncommented): In my life, I used the following web search engines:
Yahoo!
AltaVista
Google
*/