slideshow with previous and next buttons to work

slideshow with previous and next buttons to work

I am trying to get the event handler attached to my Next button to work, and then will have to do the same with a previous button. I am getting a "Not implemented" error in line 8 of the jQuery - I am newer to jQuery and Java, so not sure why this has happening and have exhausted myself trying to find out why. Besides just a fix, an explanation would be appreciated.

Buttons in HTML:

  1. <input type="button" id="previous" value="Previous" >&nbsp;&nbsp;<input type="button" id="next" value="Next" >
jQuery:

  1. var $ = function (id) { 
  2. return document.getElementById(id); 
  3. }
  4. window.onload = function () {
  5.     var listNode = $("image_list");    
  6.     var captionNode = $("caption");
  7.     var imageNode = $("image");
  8. $("next").onclick = nextImage;

  9.         
  10.     var links = listNode.getElementsByTagName("a");
  11.     
  12.     // Process image links
  13.     var i, linkNode, image;
  14.     var imageCache = [];
  15.     for ( i = 0; i < links.length; i++ ) {
  16.         linkNode = links[i];

  17.         // Preload image and copy title properties
  18.         image = new Image();
  19.         image.src = linkNode.getAttribute("href");
  20.         image.title = linkNode.getAttribute("title");
  21.         imageCache.push(image);
  22.     }

  23.    // Next Button
  24.     var imageCounter = 0;
  25.     var nextImage = $(function() { 
  26.             imageCounter = (imageCounter + 1) % imageCache.length;
  27.             image = imageCache[imageCounter];
  28.             imageNode.src = image.src;
  29.             captionNode.firstChild.nodeValue = image.title;
  30.         });
  31. }