CodingOdd JavaScript Bug

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Ally  
 To:  Peter (BOUGHTONP)      
30698.4 In reply to 30698.1 
quote:
The setTimeout(...,0) just means execute immediately. In this form, everything works fine.


Not putting it in a SetTimeout would do exactly the same thing?

And I've not seen the other thread, but try:

code:
setTimeout(eval("alert(elem('total_cost').innerText)"),0);


or

code:
setTimeout(new function() {alert(elem('total_cost').innerText)},0);
0/0
 Reply   Quote More 

 From:  Matt  
 To:  Ally     
30698.5 In reply to 30698.4 
code:
Not putting it in a SetTimeout would do exactly the same thing?


It's not. By calling a function with SetTimeout you don't interrupt the code flow following the call which means you can pretty much have have two functions running at the same time. It's like a half-arsed attempt at threading except it's not because Javascript doesn't do threading.

doohicky

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)   
 To:  Ally     
30698.6 In reply to 30698.4 
Well, what Matt says is right, but yeah it works without the setTimeout just like with it at 0.

It's working consistantly now though (with a 50ms setTimeout on the calling function instead), so it possibly might have been a JS caching issue earlier.
0/0
 Reply   Quote More 

Reply to All    
 

1–6

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats