var result = [], elems = document.getElementsByTagName( '*' ); for( var i =0, elem; elem = elems[ i++ ]; ) { if ( elem.getAttribute( 'href', 2 ) == "www.example.com" ) { result[ result.length ] = elem; } } alert( result );