# JavaScript Random Functions

**URL:** <https://forum.kirupa.com/t/javascript-random-functions/18316>\
**Category:** programming\
**Created:** [April 15, 2003, 2:56pm UTC](https://forum.kirupa.com/t/javascript-random-functions/18316 "2003-04-15T14:56:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kitiara](https://avatars.discourse-cdn.com/v4/letter/k/7ab992/32.png) [@Kitiara](https://forum.kirupa.com/u/Kitiara)\
**Post date:** [April 15, 2003, 2:56pm UTC](https://forum.kirupa.com/t/javascript-random-functions/18316/1 "2003-04-15T14:56:29Z")

</div>

I’m having a slight problem with this one, so any suggestions would be appreciated.

I have three picture gallery pages and an index page. When you click on an image on the index, a random page of the three galleries should load.

I’ve written the script OK (I think) - there’s an array of the three pages, and a quick function to determine the random one. I’ve assigned an onClick() to the image in question, and used a call Javascript action to call my random function. But whenever I click the image, it doesn’t load up a gallery page.

I’ve attached the .htm file for people to look at. If you can see what’s up with it… The random functions are in the \<head\> and the call is near the bottom of the page. :block:

---

<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:** [April 15, 2003, 4:31pm UTC](https://forum.kirupa.com/t/javascript-random-functions/18316/2 "2003-04-15T16:31:09Z")

</div>

Perhaps I am crazy, but I can’t seem to find your function.

The only array I see is the one that houses your scrolling images :-\

Are these the right files?

---

<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:** [April 16, 2003, 9:38am UTC](https://forum.kirupa.com/t/javascript-random-functions/18316/3 "2003-04-16T09:38:38Z")

</div>

I would repost the files to make sure, but the drive is disabled for a couple of hours (darn intranet update). I’ll check it when it’s back up…
