Click to See Complete Forum and Search --> : drop down menus and random images


cloudx575
06-25-2003, 10:38 AM
I want to put a dropdown menu and a random image, but I can't seem to get it to work. do i have to do something special with the onLoad in the body tag, or do I have to do something to the script inside the head tags

Khalid Ali
06-25-2003, 01:06 PM
Your question assumes that everybody around here knows exactly what is your code look like,which I think is a wrong assumption..:D ..

Please post a link to your pages or post your code so that some one can make sense out of your questions..

David Harrison
06-25-2003, 03:48 PM
I can help you with the random image bit, if you have an array of images, like this:

var image = new Array();
image[0] = "abc";
image[1] = "def";
image[2] = "ghi";

and then to get the random image have something like this:

function randimg(){
var imgnum=Math.random(Math.random() * (image.length-1));
document.write("<img src='"+image[imgnum]+".gif'>");}

and then wherever you want a random image on your page have this:

<script type="text/javascript"><!--
randimg()
//--></script>

cloudx575
06-25-2003, 11:18 PM
sorry, but nevermind, i got it down