how can i use setInterval()
to make a slideshow of images with the code i have now that only has thumbnails that display in one big div(larger pic of the thumbnail) when the thumbnail gets hovered over.(onmouseover)

this is the javascript function.: how can iuse set interval to make the images display every 5 seconds(in order)(change display)? javascript code::

function OnMouseOverMainImage(image, mainImage)
{
mainImage.src = image.src;
jsLastMainImage = image.src;
}

}
<span id="thumb">
<img src="small1.png" width="10" height="10" style="border: 0px;" onMouseOver="OnMouseOverMainImage(this,ctrl);changeme('box', 'show');" onclick="changeme('thumb', 'hide');"> <img src="image2.png" width="10" height="10" style="border:0px;" onmouseover="OnMouseOverMainImage(this,ctrl);changeme('box', 'show');" onclick="changeme('thumb', 'hide');"></span>
<br>
<div id="box" style="width:auto; height:auto;text-align:center">
<img id="ctrl" onclick="changeme('box', 'hide');" onmouseover="OnMainImageCtrlMouseOver(this,1)" onmouseout="OnMainImageCtrlOnMouseOut(this)" onmousemove="OnMainImageCtrlOnMouseMove(this,event)" src="noimage.png" style="border: 0px;"> 
</div>

Recommended Answers

All 4 Replies

SK,

I would also not use setInterval (I have never used it). Instead, create a supervisor function containing a conditional setTimeout which calls the supervisor iteratively. The condition will allow one or more events to terminate what is otherwise an endless iteration. Restart by resetting flag(s) etc. as necessary, then call the supervisor again.

This is a common pattern and a good one to learn.

Slide show is a very common piece of functionality. Personally, I would seek a ready-developed script and adapt it as necessary.

Airshow

i dont like ready developed scripts.

That's strange because you don't hold back from asking experts on Daniweb to write your scripts for you whenever you get into trouble!

Airshow

i dont do that either.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.