Hi!
New here, but i'll keep it short and as detailed as i can.
I have searched for anything similar but cant seem to find anything..
Well, here is what i am having problems with:
I'm trying to create an array (consisting only of img src) for every image loaded inside a specific div, and each img has same class. Cant see to get that to work.
When the array is created successfully, the div we just fetched from, including all child elements, will be delted/removed.
The purpose of this is:
When i have the array, im going to try to make a "photogrid" consisting of 30-50 images, (a gallery in other words) and the image sources inside this "grid" will be fetched from the array.

The img class is "photo" and the div class is "SearchResult"

Could you guys help me out ?

tried using map function without success (maybe im just missing something.. )

Embarrassing when you figure out most of it yourself.. anyway, here are the code i came up with for you guys with similar ideas!

<script type="text/javascript">
var arr = document.getElementsByClassName("photo");
    for(i=0; i < arr.length ; i++) {
document.write('<img src="' + arr[i].src + '" style="width: 65px;"/>');
}
$('.SearchResult').remove();
</script>

Explanation for you who dont really understand it and dont want to bother reading my first post:
This fetches img src from any img tag with the classname "photo", puts the images in array, creates a "photo-wall", removes the div with classname SearchResult.

its good that you posted an update. So, out of curiosity, I'm trying to understand the whole picture here... these pictures on the page were from the result of a search? If so, why not create the grid from the search results?

Well, basicly this i need because im an afflite on a website, i wont mention for several reasons, and php and so on is restricted. they wont let you get access to several functions, therefore i use this in combination with what they offer, wich gives me more room for customizations ;)

EDIT: This is actually not from a search, its some kind of premade "user" script, it gives you ability to show pictures + names of members of website, but at restricted sizes, and you cannot change the look/colors of the div they create, and you cant change names of the divs and so on...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.