ж–№ејҸдёҖ
<script type="text/javascript">
var maxTime = 10; // seconds
var time = maxTime;
$('body').on('keydown mousemove mousedown', function (e) {
time = maxTime; // reset
});
var intervalId = setInterval(function () {
time--;
if (time <= 0) {
ShowInvalidLoginMessage();
clearInterval(intervalId);
}
}, 1000)
function ShowInvalidLoginMessage() {
// жё…йҷӨcookie
// жҸҗзӨәз”ЁжҲ·
// иҜҘе№Іеҳӣе№Іеҳӣ
alert('йӮЈд№Ҳй•ҝж—¶й—ҙжІЎеҠЁеј№пјҢйҖҖеҮәе–ҪпјҒ');
$.ajax({
url: "RegisterCheck.csx?tag=logout",
dataType: "text",
success: function (response, p) {
window.location.href = "Login.html";
}
})
}
</script>
ж–№ејҸдәҢ
function ReLogin() {
window.location.href = "Login2.html";
};
var maxTime = 900; // seconds
var time = maxTime;
$(function () {
/* йј ж Үз§»еҠЁдәӢд»¶ */
$(document).mouseover(function () {
time = maxTime;
});
$(document).mousedown(function () {
time = maxTime;
});
});
var intervalId = setInterval(function () {
time--;
console.log("еҖ’и®Ўж—¶:" + time);
if (time <= 0) {
ShowInvalidLoginMessage();
clearInterval(intervalId);
}
}, 1000)
function ShowInvalidLoginMessage() {
var title = 'жҸҗзӨә', content = 'йӮЈд№Ҳй•ҝж—¶й—ҙжІЎеҠЁеј№пјҢйҖҖеҮәе–ҪпјҒ';
Ext.MessageBox.alert(title, content, function (r) {
Ext.Ajax.request({
url: "RegisterCheck.csx",
params: {
tag: "logout"
},
success: function () {
ReLogin();
}
});
});
}