There is probably a better way to do this but here is my code:
On page load I call the displayProducts function. What I want to do is start having my image display the last image in my list and then every 5 seconds switch to the next image in the list but this is not happening. Image swapping is all over the place.
Please help
Mighty
Code:
function displayProducts()
{
// Display the last image first
document.all.productName.innerHTML = products[products.length-1];
document.all.product.src = "/images/products/" + products[products.length-1] + ".jpg";
// Run a continuous loop and change image
for (i = 0; i < products.length; i++) {
// Display the current image
productTimer = window.setInterval("displayProductImage(" + i + ")", 5000)
}
}
function displayProductImage(imgNum)
{
document.all.productName.innerHTML = products[img]um[/img];
document.all.product.src = "/images/products/" + products[img]um[/img] + ".jpg";
}
On page load I call the displayProducts function. What I want to do is start having my image display the last image in my list and then every 5 seconds switch to the next image in the list but this is not happening. Image swapping is all over the place.
Please help
Mighty