phpgoal Posted June 15, 2013 Share Posted June 15, 2013 Hello, Below code works fine for slide show. But I dont want the slide show to run once i come to the page. I want to see slide show start when i call it. How can I do it? If I dont use callnow function, it works just fine. If I use the function, it does not work. It is stuck at car1 picture. <script>callnow(); function callnow(){var image1=new Image() image1.src="car1.jpg" var image2=new Image() image2.src="car5.jpg" var aa = '<img src=\"car1.jpg\" name=\"slide\" width="435" height="500" />';document.write(aa); var step=1 function slideit(){ // var aa = '<img src=\"car1.jpg\" name=\"slide\" width="435" height="500" />';// document.write(aa);////if browser does not support the image object, exit. if (!document.images) return document.images.slide.src=eval("image"+step+".src") if (step<2) step++ else step=1 //call function "slideit()" every 2.5 seconds setTimeout("slideit()",2500) } slideit() //-->}</script> Quote Link to comment https://forums.phpfreaks.com/topic/279215-slideshow-in-javascript/ Share on other sites More sharing options...
PravinS Posted June 17, 2013 Share Posted June 17, 2013 You need to call slideit() after callnow() function where ever you want to use the slide show or else u can call slideit() function in callnow() function, then u don't need to call slideit() function after callnow() function. may this will help you. Quote Link to comment https://forums.phpfreaks.com/topic/279215-slideshow-in-javascript/#findComment-1436333 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.