This is unedited production code, sort thru it and take what you want.
//in the form tag
<BODY onkeypress="window_activity()" onmousedown="window_activity()" ...
//in your javascript file
'the next few functions enable the timer which times out the user after
inactivity period
Sub StopTiming()
if timerPROMPT 0 then
window.clearTimeout timerPROMPT
end if
sTime = Now
if msgbox ("Due to inactivity, your session is about to time out. Press OK
to remain connected, Cancel to end your session.",vbOkCancel,"Logout in
Progress") = 1 then
eTime = Now
elapsed = DateDiff("m",sTime,eTime)
'user had 2 minutes to respond
if elapsed 2 then
document.all.SPREADSHEET_COMMAND.value = "CLOSE"
ClearRates()
else
window_activity()
end if
else
ClearRates()
document.all.SPREADSHEET_COMMAND.value = "CLOSE"
end if
End Sub
'monitor for user activity to determine when to time out the user
Sub window_activity()
if timerPROMPT 0 then
window.clearTimeout(timerPROMPT)
end if
timerPROMPT = window.setTimeout("StopTiming()",1800000)
End Sub
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog:
http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"MattB" <so********@yahoo.comwrote in message
news:4l************@individual.net...
I'm using the old html method of creating timeouts for my asp.net (1.1)
pages. This apparently isn't working as well as I'd hoped because it takes
a postback to reset the timer. I've had complaints of people typing into a
dialog box and having the page time out while they were typing.
Anyone got a trickier (javascript, I'd assume) way to set timeouts so that
a keystroke, or even a mouse movement resets the timer? Even if it only
worked with keystrokes and not mouse movement it would be an improvement.
LMK.
Thanks!
Matt