473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Javascript stops executing in Firefox on a window move

I have a timer function that displays to the user the current number of seconds left for the current question.

It all works fine, however when the timer is ticking down, and the user starts to drag the window, it stops. It seems to entirely stop javascript from executing.

This issue is not seen in IE. Can anyone explain why Firefox stops executing JS when the window is moved/mouse is down over the blue top of the firefox window.

I pray that IE (microsoft) have not done something better than mozilla. It just can't be so it will crush my world

:P

Thanks hor your help,
Lee

ps. this is my first post, thanks for your help
Mar 4 '08 #1
3 1905
hsriat
1,654 Expert 1GB
Welcome to TSDN.

Even I have seen that issue, not even scripts but even an animated gif stops for a while.

As a solution of your timer, instead of using setTimeout (which I think you would be) to add 1 second each time, use it to update the time by subtracting the starting time from the current time.
Mar 4 '08 #2
The code below is an example of the problem. copy and paste the below HTML & JS into an HTML document. Run the page and watch the timer count. Start moving around the firefox window and you will see that the timer stops incrementing.

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
var count = 0;
function example()
{
count++;
document.getElementById('example').innerHTML = count;

var t = setTimeout("example()",1000);

}
</script>
</head>

<body onload="example()">
<div id="example"></div>
</body>
</html>[/HTML]
Mar 4 '08 #3
hsriat
1,654 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. var startD = new Date();
  2. var startT = startD.getTime();
  3. function example() {
  4.     var nowD = new Date();
  5.     var nowT = nowD.getTime();
  6.     var count = Math.floor((nowT - startT)/1000);
  7.     document.getElementById('example').innerHTML = count;
  8.     var t = setTimeout("example()",1000);
  9. }
Mar 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
30
by: Jeff Bigham | last post by:
So, it appears that Javascript has a recursion limit of about 1000 levels on FF, maybe less/more on other browsers. Should such deep recursion then generally be avoided in Javascript?...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.