L
lucanos
Hey Guys,
Hoping that you can help me, as I have been scratching my head and
getting nothing but dandruff...
SITUATION
---------
I have a webpage which users will be viewing, which has forms which can
be hidden or displayed at the user's choice. The problem is that they
want the page to refresh every X seconds, but if it refreshes when a
form is displayed, then the form loses the entered data and disappears
as the screen is redrawn, meaning the user has to write it all up
again.
MISSION
-------
I want to create a JavaScript refresh function, which will only refresh
the page if a certain condition is met. The condition will be a
variable which will count the number of forms currently being
displayed. If the variable ('openForms') is 0, then the refresh should
be executed.
ATTEMPTS THUSFAR
----------------
function refreshCounter() {
Id = setTimeout( refreshWindow() , 100000 );
}
function refreshWindow() {
if ( openForms==0 ) {
// No Windows Open - Reloading
window.location.reload(true);
} else {
// Windows Open - NO Reload
}
}
RESULT THUSFAR
--------------
The page was constantly trying to reload the second it opened - causing
a loop which only stopped when I commented out the second line of
"refreshCounter()".
Any suggestions, or assistance would be appreciated.
Am I doing this the easiest possible way? Or is there a better option?
Thanks
Luke
Hoping that you can help me, as I have been scratching my head and
getting nothing but dandruff...
SITUATION
---------
I have a webpage which users will be viewing, which has forms which can
be hidden or displayed at the user's choice. The problem is that they
want the page to refresh every X seconds, but if it refreshes when a
form is displayed, then the form loses the entered data and disappears
as the screen is redrawn, meaning the user has to write it all up
again.
MISSION
-------
I want to create a JavaScript refresh function, which will only refresh
the page if a certain condition is met. The condition will be a
variable which will count the number of forms currently being
displayed. If the variable ('openForms') is 0, then the refresh should
be executed.
ATTEMPTS THUSFAR
----------------
function refreshCounter() {
Id = setTimeout( refreshWindow() , 100000 );
}
function refreshWindow() {
if ( openForms==0 ) {
// No Windows Open - Reloading
window.location.reload(true);
} else {
// Windows Open - NO Reload
}
}
RESULT THUSFAR
--------------
The page was constantly trying to reload the second it opened - causing
a loop which only stopped when I commented out the second line of
"refreshCounter()".
Any suggestions, or assistance would be appreciated.
Am I doing this the easiest possible way? Or is there a better option?
Thanks
Luke