> You usually get that error message when your script tries to access a
document in another frame or window it doesn't have access to due to the
same origin policy only allowing access to window/frames with documents
being loaded from the same host/domain.
Are you using any frames or popup windows, does resetTimer try to access
data in another window/frame?
I am using frames, but the pages in the other 2 frames do not have this code
in them.
Here's the code.. first time in is ok, it's the 2nd time the page is loaded
that has the problem with the attachevent.
<script>
var SRV_IDLE_TIME = 1200000;
var srv_timerID = -1;
var CLI_IDLE_TIME = 900000;
var cli_timerID = -1;
// On page load, start times and set focus
function onLoading() {
startTimer();
placeFocus();
}
// Clear timers when page unloaded
function onUnloading() {
if (cli_timerID != -1) {
clearTimeout(cli_timerID);
}
if (srv_timerID != -1) {
clearTimeout(srv_timerID);
}
}
// Start Timers
function startTimer() {
cli_timerID = window.setTimeout("timeOut()",CLI_IDLE_TIME);
srv_timerID = window.setTimeout("timeOut()",SRV_IDLE_TIME);
}
// Restart the client side inactivity timer
function resetTimer() {
if (cli_timerID != -1) {
clearTimeout(cli_timerID);
cli_timerID = window.setTimeout("timeOut()",CLI_IDLE_TIME);
}
}
// Client side inactivity timeout
function timeOut() {
if (cli_timerID != -1) {
clearTimeout(cli_timerID);
}
cli_timerID = -1;
if (srv_timerID != -1) {
clearTimeout(srv_timerID);
}
srv_timerID = -1;
location.href='logout.aspx';
}
function placeFocus() {
if( Form1.elements[0]!=null) {
var i;
var max = Form1.length;
for( i = 0; i < max; i++ ) {
if( Form1.elements[ i ].type != "hidden" &&
!Form1.elements[ i ].disabled &&
!Form1.elements[ i ].readOnly &&
(Form1.elements[ i ].type == "text" ||
Form1.elements[ i ].type == "textarea") ) {
Form1.elements[ i ].focus();
break;
}
}
}
}
document.attachEvent("onmousemove", resetTimer);
document.attachEvent("onclick", resetTimer);
document.attachEvent("onkeydown", resetTimer);
</script>
<body onload="onLoading();" onunload="onUnloading();" .....etc