var c = 0; for (var i=0; i<document.links.length; i++) if(document.links[i].href.substr(0,7) == "http://") c++; alert(c);