title: I need suspend input to my calculator display when buttons are hi-lighted. Can't figure out why my setTimeout() isnt working.
body: <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt; Buttons&lt;/title&gt;
   &lt;style type="text/css"&gt;
  
  .intro{background-color:;}
  .duction{background-color:blue;}
  &lt;/style&gt;
  
  
  
  
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="calculator"&gt;
  &lt;input type="text"  name="display" length="50" width="100"&gt;
  &lt;div&gt;
  &lt;input type= "button" value="7" class="intro" id="seven" onclick="one(7)"&gt;
  &lt;input type= "button" value="8" class="intro" id="eight" onclick="one(8)"&gt;
  &lt;input type= "button" value="9" class="intro" id="nine" onclick="one(9)"&gt;
  &lt;input type= "button" value="+" class="intro" id="plus" onclick="one('+')"&gt;
  &lt;input type= "button" value="-" class="intro" id="minus" onclick="one('-')"&gt;
  &lt;div&gt;
  &lt;input type= "button" value="4" class="intro" id="four" onclick="one(4)"&gt;
  &lt;input type= "button" value="5" class="intro" id="five" onclick="one(5)"&gt;
  &lt;input type= "button" value="6" class="intro" id="six" onclick="one(6)"&gt;
  &lt;input type= "button" value="x" class="intro" id="multiply" onclick="one('*')"&gt;
  &lt;input type= "button" value="/" class="intro" id="divide" onclick="one('/')"&gt;
  &lt;div&gt;
  &lt;input type= "button" value="1" class="intro" id="one" onclick="one(1)"&gt;
  &lt;input type= "button" value="2" class="intro" id="two" onclick="one(2)"&gt;
  &lt;input type= "button" value="3" class="intro" id="three" onclick="one(3)"&gt;
  &lt;input type= "button" value="=" class="intro" id="equal" onclick="Evaluate()"&gt;
  &lt;div&gt;
  &lt;input type= "button" value="0" class="intro" id="zero" onclick="one(0)"&gt;
  &lt;input type= "button" value="." class="intro" id="decimal" onclick="one('.')"&gt;
  &lt;input type= "button" value="c" class="intro" id="clear" onclick="clearDigit()"&gt;
  &lt;/form&gt;
  
  &lt;script type="text/javascript" src="C:\Users\LS\Desktop\QBJS\button.js"&gt;
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  var timer;
  var object;
  var thing;
  var digit="";
  var result;
  var first;
  var that;
  var hilighted;
  </code></pre>
  
  <p>This function is supposed to suspend input to the calc. display when a button is highlighted. When no button is hi-lighted, it adds digits to the display. My timer was working before I added the if statement, and I can't figure out what needs to change to accommodate the if statement.</p>
  
  <pre><code>function one(event)
  {
  
  if (thing.className=="duction")
    {alert("x");}
  else {
  clearTimeout(timer);
  timer=setTimeout(function(){AddDigit(event);},200);};
  
  }
  
  function AddDigit(x)
  {
  
     if (typeof parseInt(x, 10) === "number" ) 
  
      {document.calculator.display.value+=x;}
     else 
  
      {document.calculator.display.value+=digit + x;}
   }
  
  
  
   function Evaluate()
   {
    result=eval(document.calculator.display.value);
   document.calculator.display.value = result;
   }
  
  
  
   document.ondblclick=function(button)
   {
     clearTimeout(timer);
  
   thing=button.target;
  
   thing.value;
  
   if(thing.className=="intro")
    {thing.className="duction";}
  
  
   else if(thing.className=="duction")
    {thing.className="intro";}    
  }
  
  
  
  function clearDigit()
  {
  document.calculator.display.value="";
  }
  </code></pre>