<!--------------HIDE FROM NON-JS BROWSERS---------------------------->
var count=1;                           //initialise the image counter to 1

function nextPic() {                   // Define a function to move to next image
if (count < 26) {                       // There will be 26 images
count ++                               // Add 1 to the counter
document.display.src=count+".jpg";     //Show the image called 1.jpg
} else {
count=1                                // when the counter is 26 go  back to 1
document.display.src="1.jpg";
}
}

function prevPic() {                  // Define a function to get the previous image
if (count >1) { 
count --                              // Subtract 1 from the counter
document.display.src=count+".jpg";
} else {
count=26                               // When the counter is 1 go to  26
document.display.src="26.jpg";
}
}
<!---------------------END HIDE-------------------------------->