1var rawHTML = '<html><body><a href="foo">bar</a><a href="narf">zort</a></body></html>';
2
3var doc = document.createElement("html");
4doc.innerHTML = rawHTML;
5var links = doc.getElementsByTagName("a")
6var urls = [];
7
8for (var i=0; i<links.length; i++) {
9 urls.push(links[i].getAttribute("href"));
10}
11alert(urls)
12