title: Binding Keyboard to Onclick Event
body: <p>I am having problems with a jquery slideshow where I want to bind next/right to make the images jump forwards/back.</p>
  
  <p>I used the following code to attempt to do it but it simply refreshes the page.</p>
  
  <pre><code>&lt;script&gt;
  $(function() {$(document).keyup(function(e) {
  switch(e.keyCode) { case 37 : window.location = $('#prev a').attr('href'); break;
  case 39 : window.location = $('#next a').attr('href'); break; }});});
  &lt;/script&gt;   
  </code></pre>
  
  <p>The  I was attempting to call were:</p>
  
  <pre><code>&lt;a href='#' id='prev' onclick='show_image($prev); return false;'&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;a href='#' id='next' onclick='show_image($next); return false;'&gt;
  </code></pre>
  
  <p>Does anyone know an easy way to cut out the middle man and simply bind left/right to the onclick event for each? </p>
  
  <p>Anyhelp would be much appreciated!</p>