title: javascript race condition
body: <p>I'm calling a javascript function that sets the opacity of an iframe an unknown amount of times in rapid succession.  Basically this tweens the alpha from 0 to 100.
  here is the code</p>
  
  <pre><code>
     function setAlpha(value)
     {
         iframe.style.opacity = value * .01;
         iframe.style.filter = 'alpha(opacity =' + val + ')';
     }
  
  </code></pre>
  
  <p>My problem is that for the first time it is working in ie (7) and not in firefox (3.02).  in Firefox I get a delay and then the contentdocument appears with an opacity of 100.  If I stick an alert in it works, so I'm guessing it is a race condition (although I thought javascript was single threaded) and that the setAlpha function is being called before the last function has finished executing.
  Any help would be greatly appreciated.  I've read the 'avoiding a javascript race condition post' but I think this qualifies as something different (plus I can't figure out how to apply that example to this one).</p>