Jump to content

slideshow not working


papillonstudios

Recommended Posts

ok i have this code

var step=1
function slideit(action,start,finish){
if(action == 'abort'){ 
        return
    }
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<finish)
step++
else
step=start
//call function "slideit()" every 2.5 seconds
timer = setTimeout("slideit()", 1000);
}

 

I have like 17 images but i onyl want 5 or 6 displaying on each page so i added the "start" and "finish" variables to the slideIt() function.

 

and then call this on an image slideIt(1,6) but it doesnt work.

 

What am i doing wrong?

Link to comment
Share on other sites

well first of all your first variable is action. So need to change the declaration like so.

Function slideit(start,finish,action)

 

Secondly in the recursion.

timer = setTimeout("slideit()", 1000);

 

You're not declaring your variables. It should look like this.

timer = setTimeout("slideit(start,finish)", 1000);

 

So try this.

var step=1
function slideit(start,finish,action){
   if(action == 'abort'){
        return
    }
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<finish){
step++
}
else{
step=start
}
//call function "slideit()" every 2.5 seconds
timer = setTimeout("slideit(start,finish)", 1000);
}

 

In total your code is sorta inefficient. If you'd like me to make a more efficient code for you post.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.