Jump to content

slideshow in javascript


phpgoal

Recommended Posts

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>
Link to comment
Share on other sites

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.

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.