When you call nextphoto()
and lastphoto()
you are only changing the step
variable... you aren't actually doing anything with it.
(Edit: I've just noticed that you've already defined step
... my mistake)
Firstly, you need to call slideit()
within nextphoto()
and lastphoto()
...
function nextphoto() {
step = step + 1; // This can also be done with step++;
slideit();
}
function lastphoto(){
step = step - 1; // This can also be done with step--;
slideit();
}
Secondly, you should really think about using arrays instead of individual variables.
For instance...
var images = [];
images.push("http://3.bp.blogspot.com/-5A5xpicPF5g/T8srguvp3TI/AAAAAAAAEPs/bLuFIK0gDss/s400/nature-wallpaper-23.jpg")
images.push("http://1.bp.blogspot.com/-IlYDMtyXMRU/Tekx0hgHwOI/AAAAAAAAQg8/rhY1roUhBEQ/s400/Nature%252520Mountains%252520photo.jpg")
Then you can go through images[0]
, images[1]
etc