# Help with Randomly loading pictures

**URL:** <https://forum.kirupa.com/t/help-with-randomly-loading-pictures/102010>\
**Category:** Uncategorized\
**Created:** [February 18, 2004, 9:56pm UTC](https://forum.kirupa.com/t/help-with-randomly-loading-pictures/102010 "2004-02-18T21:56:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joysik](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@Joysik](https://forum.kirupa.com/u/Joysik)\
**Post date:** [February 18, 2004, 9:56pm UTC](https://forum.kirupa.com/t/help-with-randomly-loading-pictures/102010/1 "2004-02-18T21:56:28Z")

</div>

Hello there, I need some help with making it so each time you refresh a page somewhere in that page there is an image when will randomly load 1 / 20 when you refresh, you’re great people if you help!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 19, 2004, 2:00pm UTC](https://forum.kirupa.com/t/help-with-randomly-loading-pictures/102010/2 "2004-02-19T14:00:44Z")

</div>

You can use some javascript:

```auto
<script type="text/javascript">
	var pictures_array = new Array("bug","house","me_and_mygirl");//add all your images here
	var index = Math.floor(Math.random()*pictures_array.length);
	document.write("<img src='"+pictures_array[index]+".jpg'>");
</script>

```
