I'm not very well learned in javascript, so I need a bit of help. I have a random product image and link that appears on a page of my site every time the page is refreshed. I got it working, and it works well. Now what I'd like to do is to make it to where the product image and link will rotate to another random product every few seconds or so. This is what I have for now minus the other 1,588 other products in the list. Also, I just replaced all the urls with "url" so it will display:
<script language="JavaScript">
images = new Array(1592);
images[0] = "<a href = 'url'>Biohazard Sunglasses Virii Wrap Blue Tortoise Gradient</br><img src='url' alt='Biohazard Sunglasses Virii Wrap Blue Tortoise Gradient' height='240px' width='320px' border='0'></a>";
images[1] = "<a href = 'url'>Venom II Bobster Black Aluminum Polarized Sunglasses</br><img src='url' alt='Venom II Bobster Black Aluminum Polarized Spring Hinged Sunglasses' height='240px' width='320px' border='0'></a>";
images[2] = "<a href = 'url'>X Loop Snow Ski Goggles XSG1 Carbon Fiber Orange</br><img src='url' alt='X Loop Snow Ski Goggles XSG1 Carbon Fiber Orange' height='240px' width='320px' border='0'></a>";
images[3] = "<a href = 'url'>Oxen Wide Big Head Aviator Sunglasses Silver Mirror</br><img src='url' alt='Oxen Wide Big Head Aviator Sunglasses Silver Mirror' height='240px' width='320px' border='0'></a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
//done
// --></script>
This is all in the body. Now, like I said, this works as a random product link generator, but I need it to rotate randomly every few seconds.
Any help would be appreciated. Thanks!
<script language="JavaScript">
images = new Array(1592);
images[0] = "<a href = 'url'>Biohazard Sunglasses Virii Wrap Blue Tortoise Gradient</br><img src='url' alt='Biohazard Sunglasses Virii Wrap Blue Tortoise Gradient' height='240px' width='320px' border='0'></a>";
images[1] = "<a href = 'url'>Venom II Bobster Black Aluminum Polarized Sunglasses</br><img src='url' alt='Venom II Bobster Black Aluminum Polarized Spring Hinged Sunglasses' height='240px' width='320px' border='0'></a>";
images[2] = "<a href = 'url'>X Loop Snow Ski Goggles XSG1 Carbon Fiber Orange</br><img src='url' alt='X Loop Snow Ski Goggles XSG1 Carbon Fiber Orange' height='240px' width='320px' border='0'></a>";
images[3] = "<a href = 'url'>Oxen Wide Big Head Aviator Sunglasses Silver Mirror</br><img src='url' alt='Oxen Wide Big Head Aviator Sunglasses Silver Mirror' height='240px' width='320px' border='0'></a>";
index = Math.floor(Math.random() * images.length);
document.write(images[index]);
//done
// --></script>
This is all in the body. Now, like I said, this works as a random product link generator, but I need it to rotate randomly every few seconds.
Any help would be appreciated. Thanks!