473,513 Members | 3,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change setTimeout length. Or Pause or something.

I have a frameset where a hidden frame reloads every 5 seconds and
collects data from the sever if there are any changes made in a
database. The hidden page updates Div fields on other frames with the
lastest information. This works great.

The problem I have is that when the hidden frame reloads it steals
focus from the main frame where a user can be entering information
into a form. (This is very annoying. As tabing through form elements
is stolen every 5 seconds.)

I looked at running a script to remember the element that had focus
and pass the focus back to that element from the hidden frame when the
reload is complete but that seems a messy way to do it and the cursur
seems to always go to the beginning of the form element not to where
you where typing.

I have the 5 second reload running in the Main frameset page.
----------------------------------
<script language="JavaScript1.2">
<!--
function keepUpdated()
{
setTimeout( "refresh()", 5*1000 );
}
function refresh()
{
window.updateStats.location.reload( false );
keepUpdated();
}
//-->
</script>

<frameset rows="29,*,0,20" onload="keepUpdated();">
<frame name="topMenu" target="middle" src="./frame_TopMenu.asp">
<frameset cols="172,*">
<frame name="left" src="frame_LeftMenu.asp" target="middle">
<frame name="middle" src="./login.asp" target="_self">
</frameset>
<frame name="updateStats" src="./frame_Hidden.asp">
<frame name="bottom" src="./frame_Bottom.asp">
</frameset>

----------------------------------
What I think would be a better way of handling the reload would be
when a data entry page is called to pass to the refresh function a new
timeout value of 5 minutes. Then when the data entry is complete (The
user submits a form) send the timeout value of 5 seconds again. (This
way the reload is supended for a while so you can enter data without
the reload stealing focus.)

I'm new to Javascript and not sure how I can set up a variable to do
this. Could someone show me some code on how to do this or another
solution to my problem would be great. Thanks.
Jul 23 '05 #1
1 2354
Knud wrote:

<--snip-->
What I think would be a better way of handling the reload would be
when a data entry page is called to pass to the refresh function a new
timeout value of 5 minutes. Then when the data entry is complete (The
user submits a form) send the timeout value of 5 seconds again. (This
way the reload is supended for a while so you can enter data without
the reload stealing focus.)
Thats a possibility. But what happens if they leave the app for an hour,
something gets changed that they are working on, yet it doesn't get updated?
I'm new to Javascript and not sure how I can set up a variable to do
this. Could someone show me some code on how to do this or another
solution to my problem would be great. Thanks.


Look into an HTTPRequestObject
http://jibbering.com/2002/4/httprequest.html

Its IE/Mozilla only but I believe it can do what you want (timed
updates) without stealing focus.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2921
by: Mool | last post by:
I want to use a setTimeout to just loop for a number of seconds, then fall through to the next bit of code...can this be done by using some kind of null in the statement, or do I have to assign the code a name and call it from the setTimeout once it's done? Thanks so much!
1
1614
by: Better but still clumpsy | last post by:
Hi, I have a script that is looping like this : for (i=0;i<100;i++) { do 1 do 2 display setTimeout("timer",1000);
3
4739
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
28
5249
by: Andre | last post by:
Hi, Does anyone know whether the ECMA, or an other standard document, specifies a maximum for the value that can be pass to the setTimeOut() function in Javascript? Andre
1
8175
by: Chris Moltisanti | last post by:
Hey, I am using the setTimeout() function in IE to pause the execution of another funciton for a few seconds. My function is as follows: funtion test(e) { // the parameter 'e' is the event // do something }
1
1783
by: Noggon | last post by:
Maybe I'm stupid, but I can't find out what is wrong, can anyone help? I keep getting the function first as being undefined for some reason I don't get. I'm trying to use setTimeout() to pause execution so that an image in my web page is switched every two seconds for another. switch(pic_catagory)
6
1742
by: daveyand | last post by:
Hey Guys, I've stumped. I created a function that does various things to select boxes. Namely Get All selected indexes, populate array with these values
6
10898
by: Max | last post by:
Hi, I'm not exactly sure why this doesn't work. I'm basically just trying a simple approach at a slide down div. function slide_div { setTimeout("document.getElementById('mydiv').style.length='10px';",1000);
4
5182
by: Adam Risser | last post by:
Hi everyone, I am modifying the suckerfish dropdown code to use settimeout to have a slight pause before the menus disappear to make it more user friendly. I have hit a snag with the following statement: li.onmouseout=function() { timerID=setTimeout('this.getElementsByTagName("UL") .style.display = "none"', timecount);
0
7269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7542
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.