View Single Post
Old 01-17-2013, 04:19 AM   PM User | #1
samhor
New Coder

 
Join Date: Mar 2012
Location: USA
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
samhor is an unknown quantity at this point
Question javascript slideshow - can't get the first slide and last slide button to work.

Hello All,

I have made the below js slideshow but i can't seem to get the button to take you back to the first/last slide
Any ideas?
Code:
<p><center><h1> Slide Show - Devices</h1></center></p>
	    <script language="JavaScript">
var count = 0
var images = new Array('bblogo.jpg','applelogo.jpg','alogo.jpg','iphone45.jpg')
function imageslideshow( btnselection){

 if ( btnselection == 'next' && count <=2){
 count++
 }

 if ( btnselection == 'back' && count >=1){
 count --;
 }
  if ( btnselection == 'firstslide' && count >=count+1){
 count 
 if ( btnselection == 'lastslide' && count >=count+4){
 count 
 }
 
  document.getElementById("imagecount").innerHTML = (count+1)+" of 4 <br> <img src='images/"+images[count]+"'>"
  
}  
</script>
<div id="imagecount"><script>imageslideshow()</script></div>
<input type="button" value="Previous" onclick="imageslideshow('back')">
<input type="button" value="Next" onclick="imageslideshow('next')">
<input type="button" value="First Slide" onclick="imageslideshow('firstslide')">
<input type="button" value="Last Slide" onclick="imageslideshow('lastslide')">
samhor is offline   Reply With Quote