Hey Everyone, first time user, learning to use java, CSS, and other tools.
I am having a problem that I cannot seem to figure out the solution.
What I’m looking to do is have a folder of images that I have show up on my website. I’m also looking to pull from this folder up to 6 or 7 times on the same page w/ randomized pictures that do not repeat.
Finally, I’m looking to be able to size and name these images based on which image randomly pulls.
If I didn’t explain myself well enough, [url]www.***************
Thanks!
P.S… this is what I have right now, but I don’t think it’s correct, b/c it’s not grabbing the images.
images = new Array()
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/bg.jpg’
images[images.length] = ‘images/bg.jpg’
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/example.jpg’
images[images.length] = ‘images/example.jpg’
how_many=6
function show_pic(){
for(i=0;i<how_many;i++){
rndnum=Math.floor(Math.random()*images.length)
document.images[“mypic”+i].src=images[rndnum]
images.splice(rndnum,1)
}
}
In my HTML, I am using this:
<onload=”show_pic()”>
<ul class=”main_image”>
<li><a href=””><img title=”mypic0″ width=308 height=460></a></li>
<li><a href=””><img title=”mypic1″ width=308 height=460></a></li>
</ul>
<ul class=”other_image”>
<li><a href=”#”><img title=”mypic2″ width=144 height=216></a></li>
<li><a href=”#”><img title=”mypic3″ width=144 height=216></a></li>
<li><a href=”#”><img title=”mypic4″ width=144 height=216></a></li>
<li><a href=”#”><img title=”mypic5″ width=144 height=216></a></li>
</ul>