If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Getting a random picture to display

Hi, I'm trying to get it so that a random picture displays from a gallery file one at a time. I'm probably making a basic syntax error somewhere as I'm fairly new to JavaScript/jQuery, but please can someone help? I can't get a picture to display in the div at all. Any help would be great, thanks!!

N.B. the pictures are called e.g. 101.jpg, 102.jpg - so I thought a random number generator would be best to get a random picture.

I've been playing around with this a bit, and have tried using arrays - now I can get something to appear in the div, but it looks like this:
�V��$��F��Ⱦ36�H�W���/+�N�FC�C b8͔��@�5^��
etc... so I assume it is pulling it up in the wrong format or something? Also, the image isn't changing, it only changes when I refresh the page - am I not calling the function back correctly?
Any help on how to correct this would be much appreciated, thanks!!

Thanks so much - sorry I'm fairly new at all of this so I don't know how to do all of that!

Got this now - but problem is that now nothing displays in the div at all - if I remove the bannerGen function completely then a picture does display in the div, but I need the picture to change, about every 4 seconds - how do I do this!? Use a timeout or a pause or something? I need to be able to get the bannerGen function to loop indefinately.

That code does get a random image to appear where I want it to - but I need the image to refresh every 4 seconds or so and I don't know how to get the whole function to cycle after this time frame. I'm fairly new to JS/jQ, so I apologise if this is a fairly noob question - I don't fully understand the code you have written enough to edit it myself. Thank you :0)