title: How do I implement press and hold button javascript?
body: <p>I'm a complete novice, looking for instructions on implementing javascript.  I am attempting to replace a YUI slider with buttons and a text field.  I am trying to achieve buttons that, when held down, will continue to make the text field increase, preferably at a faster and faster rate.  (<a href="http://www.blackbird502.com/white.htm)I" rel="nofollow noreferrer">http://www.blackbird502.com/white.htm)I</a> have this in the java tag in the head:</p>
  
  <pre><code>function holdit(btn, action, start, speedup) {
  var t;
  
  var repeat = function () {
      action();
      t = setTimeout(repeat, start);
      start = start / speedup;
  }
  
  btn.mousedown = function() {
      repeat();
  }
  
  btn.mouseup = function () {
      clearTimeout(t);
  }
  
  /* to use */
  holdit(btn, function () { }, 1000, 2); 
  /* x..1000ms..x..500ms..x..250ms..x */
  </code></pre>
  
  <p>I have no clue how to implement the press and hold into the following in the body:</p>
  
  <pre><code>&lt;form&gt;&lt;input type=button value="UP"  class="btn" onClick="javascript:this.form.amount.value++;"&gt;&lt;br /&gt;&lt;input type=text name=amount value=5 class="text"&gt;&lt;br /&gt; &lt;input type=button value="DOWN"  class="btn" onClick="javascript:this.form.amount.value--;" &gt;&lt;/form&gt;
  </code></pre>
  
  <p>Is it possible?  Thanks.</p>