Skip to content

Instantly share code, notes, and snippets.

Created August 5, 2011 13:12
Show Gist options
  • Save anonymous/1127516 to your computer and use it in GitHub Desktop.
Save anonymous/1127516 to your computer and use it in GitHub Desktop.
var links = document.getElementsByTagName("a");
for ( var i = 0 ; i < links.length ; i++ ){
var link = links[i];
link.href = "#";
link.onclick = function(){ alert( i ) };
link.innerHTML = i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment