Hello everybody,
I’m trying to build a Facebook’s Like Box-like widget.
I’ve an array of users I want to display at random along with their associative pictures.
Here’s the code I’ve been done so far:
HTML
<ul id=myList>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
Javascript
var myList = document.querySelectorAll('#myList li'),
users = [user1, user2, user3, user4, user5],
images = [image1, image2, image3, image4, image5];
myList[0].innerHTML = '<img src="' + images[0] + '" />';
How do I do this in a for loop, provided that I don’t know how many user logged in and if I want to pick just only five at a time.
Thank you,