papillonstudios Posted July 29, 2010 Share Posted July 29, 2010 I was wondering how you stop a Function Execution. What i have is a basic slide show. and i want when you roll over the image it plays the slideshow but when you onMouseOut it reverts back to the first image and stops the slideshow. So far i have the slideshow working, the onMouseOver and onMouseOut fumctions working . except in the onMouseOut function i dont have it stopping the slideshow. heres my two functions and where im using them. //variable that will increment through the images var step=1 function slideit(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<6) step++ else step=1 //call function "slideit()" every 2.5 seconds setTimeout("slideit()",1000) } function slideOff() { document.images.slide.src=eval("image1.src") slideit(abort) } <img src="contact/images/wingham/01.jpg" onmouseover="slideit()" onmouseout="slideOff()" name="slide" width=150" > Quote Link to comment Share on other sites More sharing options...
xenophobia Posted July 30, 2010 Share Posted July 30, 2010 Try to declare a variable to hold your timer object. var timer; function slideit(action) { [....] timer = setTimeout("slideit()", 1000); } function slideoff() { clearTimeout(timer): [...] } Quote Link to comment Share on other sites More sharing options...
papillonstudios Posted July 30, 2010 Author Share Posted July 30, 2010 thanks man exactly what i wanted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.