Wednesday, June 25, 2014

membuat Otomatis refresh halaman ketika tidak ada aktifitas selama 5 menit

<body onmousemove = "canceltimer()"; onclick = "canceltimer()">

<script type = "text/javascript">

var tim = 0;
function reload () {
tim = setTimeout("location.reload(true);",300000);   // 5 minutes
}

function canceltimer() {
window.clearTimeout(tim);  // cancel the timer on each mousemove/click
reload();  // and restart it
}

</script>

No comments:

Post a Comment