我在asp.net母版页的标题中放置了以下脚本。母版页标题中的Javascript
在特定的非活动时间结束后,该脚本应该如何重新指向Timeout.aspx
页面。
如果用户在页面上滚动/点击,则重置时间。在运行页面,我得到一个错误:
Jscript engine runtime error: object expected.
代码:
var wintimeout;
function SetWinTimeout() {
wintimeout = window.setTimeout("window.location.href='../Timeout.aspx';",
60000); //after 5 mins i.e. 5 * 60 * 1000
}
$('body').click(function() {
window.clearTimeout(wintimeout);
//when user clicks remove timeout and reset it
SetWinTimeout();
});
window.onload = SetWinTimeout;
您有加入了jQuery脚本你的主页? jquery脚本包含必须*位于你的脚本之上 – mortb
我已经将它添加到页面的头部 –