Is there a way to stop setTimeout(\"myfunction()\",10000); from counting up when the page isn\'t active. For instance,
What you'd have to do is set up a mechanism to set timeouts at small intervals, keeping track of total elapsed time. You'd also track "mouseenter" and "mouseleave" on the whole page (the or something). When the short-term timeouts expire, they can check the window state (in or out) and not restart the process when the window is not in focus. The "mouseenter" handler would start all paused timers.
edit — @Šime Vidas has posted an excellent example.