Javascript error in random image rotator?

By Men-an-tol ·
Can anybody with sharp eyes tell me where I've gone wrong please? It's ages since I wrote a script so it's probably obvious to someone...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
var gallery = new Array();
var gallery[0] = new Array("IMG_2112.JPG","IMG_2121.JPG","IMG_2141.JPG","IMG_2175.JPG","IMG_2210.JPG","IMG_2218.JPG","IMG_2228.JPG","IMG_2232.JPG");
var gallery[1] = new Array("IMG_2117.JPG","IMG_2190.JPG","IMG_2199.JPG","IMG_2215.JPG","IMG_2255.JPG","IMG_2258.JPG","IMG_2261.JPG");
var gallery[2] = new Array("rea.jpg","napit.jpg","mcs.jpg");

function pickImageFrom(whichGallery){
var idx = Math.floor(Math.random() * gallery[whichGallery].length);
document.write('<img src="thumbs/' + gallery[whichGallery][idx] + '">');


<div align="center">

<script language="javascript">pickImageFrom[0];</script>
<br />
<script language="javascript">pickImageFrom[1];</script>
<br />
<script language="javascript">pickImageFrom[2];</script>

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums