You are for an iterator to iterate over all the properties of your array, which will not be separate elements, but rather 0 , 1 , 2 , ..., n , length .
You want to change your iterator, and if you want a link prefix, you are doing it wrong too. What you are doing now will replace linkblur.com... an empty string, i.e. Remove the link from existing links.
var links = document.getElementsByTagName('a'); for (var i = 0; i < links.length; i++) { links[i].href = 'http://linkblur.com/?' + links[i].href; }
source share