# Functions

**URL:** <https://forum.kirupa.com/t/functions/78660>\
**Category:** Uncategorized\
**Created:** [February 6, 2005, 11:04pm UTC](https://forum.kirupa.com/t/functions/78660 "2005-02-06T23:04:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trundrumbalind](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/trundrumbalind/32/696_2.png) [@trundrumbalind](https://forum.kirupa.com/u/trundrumbalind)\
**Post date:** [February 6, 2005, 11:04pm UTC](https://forum.kirupa.com/t/functions/78660/1 "2005-02-06T23:04:32Z")

</div>

OK, I don’t use javascript much but basically I’ve created the following function and it’s not working…

```auto
function randompic(passednumber) { maincell2.style.backgroundImage='url(bgimages/bgimage_[passednumber].jpg)';
}

```

And I’m using the following code to access it:

```auto
<a href="JavaScript: randompic('3');">Randomize

```

[url=“javascript%3Cb%3E%3C/b%3E:%20randompic%28%273%27%29;”]

I’m pretty sure it’s the “[passednumber]” bit that I’m messing up so if anyone has any ideas, I’d really appreciated it.

P.S. _ **200 POSTS!** _
