Javascript clickable slideshow

I did NOT write this, I wanted a javascript slidshow to show off project screen shots and found this code and wanted to make sure I had it in my archives to search for later! Got this off: http://www.javascriptkit.com/howto/show3.shtml 

in head:

<script type="text/javascript">
<!--
//preload images
var image1=new Image()
image1.src="images/screenshot.jpg"
var image2=new Image()
image2.src="images/screenshot2.jpg"
var image3=new Image()
image3.src="images/screenshot3.jpg"
var image4=new Image()
image4.src="images/screenshot4.jpg"
//-->
</script>

In the body where you want the "images" to show up...

<a href="javascript:slidelink()">
<img src="images/screenshot.jpg" name="slide" border="0" width="492" height="354" /></a>
<script type="text/javascript">
<!--
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<4)
step++
else
step=1
setTimeout("slideit()",4000)
}
slideit()
function slidelink(){
if (whichimage==1)
window.location="page1.html"
else if (whichimage==2)
window.location="page2.html"
else if (whichimage==3)
window.location="page3.html"
else if (whichimage==4)
window.location="page4.html"
}
//-->
</script>



posted @ Thursday, May 14, 2009 1:49 PM

Print

Comments on this entry:

# re: Javascript clickable slideshow

Left by Rapid Share at 1/27/2010 2:31 AM
Gravatar
I love this feature! It saves a lot of clutter on my sidebar, well not that it's clutter but that it was once sooo long and now it's in a compact little space. I only wish there was a way to speed up or slow down the slideshow so I can get to the blog I want quickly. Oh well can't have it all, huh? :D I use Internet Explorer and at first it was kind of 'skipping' and would only show just a few 'buttons', but after I played around with it a lot I somehow managed to have it flow all the way through. YAY! Thanks for all your tips!!! Your button is in my slideshow too!!! :D

Your comment:



 (will not be displayed)


 
 
 
Please add 5 and 1 and type the answer here:
 

Live Comment Preview:

 

Over 13 years of Internet experience and website marketing. Tim Maxey's Tech Blog. Set out to help the lives of others by making their programming easier. No one is the "best" programmer, every good programmer knows that, or should. Always keep learning and if you do not like it, get out of it. Do what makes you happy! My main purpose is to help youth and also anyone for that matter learn they can make a good living in technology!