K
Knud
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.
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.