# Random Image + Maps

**URL:** https://forum.kirupa.com/t/random-image-maps/22918
**Category:** programming
**Created:** [June 10, 2003, 5:29pm UTC](https://forum.kirupa.com/t/random-image-maps/22918 "2003-06-10T17:29:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![redViper](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@redViper](https://forum.kirupa.com/u/redViper)
#### Post date: [June 10, 2003, 5:29pm UTC](https://forum.kirupa.com/t/random-image-maps/22918/1 "2003-06-10T17:29:29Z")

</div>

Ok, heres the deal.  
I have a bunch of images, and I want them to rotate everytime a person comes. Im using this code:

```php

            <script language="JavaScript">
<!--

/*
Random Image Script- By JavaScript Kit (http://www.javascriptkit.com) 
Over 400+ free JavaScripts here!
Keep this notice intact please
*/

function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="images/top1.gif"
myimages[2]="images/top2.gif"
myimages[3]="images/top3.gif"

var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<img src="'+myimages[ry]+'" usemap="#FPMap3" border=0>')
}
random_imglink()
//-->
            </script>

```

Ok, the images are all the same size. and I have a image map code I want to use. and the hot spots are all gonna be in the same place. now you can see “usemap=”#fpmap3" and I tried it, and didnt work.

does anyone know what I can do? or is there another code I could use?

---

<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: [June 10, 2003, 5:37pm UTC](https://forum.kirupa.com/t/random-image-maps/22918/2 "2003-06-10T17:37:37Z")

</div>

What isn’t working? the hot spot? or the images? cuz the image is random for me when I copy and paste the script into one of my pages…

---

<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: [June 10, 2003, 5:42pm UTC](https://forum.kirupa.com/t/random-image-maps/22918/3 "2003-06-10T17:42:14Z")

</div>

the hot spot.

---

<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: [June 11, 2003, 2:52am UTC](https://forum.kirupa.com/t/random-image-maps/22918/4 "2003-06-11T02:52:34Z")

</div>

anyone?!
