calling javascript method on onclick and onkeypress events
<p>I have a search box and search button. I want to call a javascript method in case somebody types in search box and hits enter or clicks on search button. </p>

<p>So far with keypress event it's working fine:</p>

<pre><code> function Search(e) {                                   
   if(e.keyCode==13) {                  
        //DO operation
   }
  }
</code></pre>

<p>If I want to call same function on onclick event of search button, how can I use same method  shown above. Only purpose here is not to duplicate same code by writing two different methods which at the end do same thing.</p>
