JAVASCRIPT fire event when is idle javascript - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

fire event when user is idle javascript


 555

JAVASCRIPT


2

<!DOCTYPE html>
<html>
<head>
</head>
<body>

<script type="text/javascript">

var text = document.createElement("p");
var timeoutInMiliseconds = 5000;
var timeoutId;

function startTimer() {
timeoutId = window.setTimeout(doInactive, timeoutInMiliseconds)
}

function doInactive() {
text.innerHTML = "you are idle!";
document.getElementsByTagName('body')[0].appendChild(text);
}

function resetTimer() {
text.innerHTML = "";
document.getElementsByTagName('body')[0].appendChild(text);
window.clearTimeout(timeoutId)
startTimer();
}

function setupTimers () {
document.onmousemove = resetTimer;
document.onmousedown = resetTimer;
document.onkeypress = resetTimer;
document.onkeyup = resetTimer;
document.onscroll = resetTimer;
document.ondblclick = resetTimer;
document.onclick = resetTimer;

startTimer();
}


// initialization

setupTimers();

</script>

</body>
</html>


By     Created   
The power of the user (%)
9%



The most helpful JAVASCRIPT solutions

How to get client machine name or computer name with javascript ?How to get client machine name or computer name with javascript ?JAVASCRIPT

Click to see more ...

  3.3K     362

get client hostname javascriptget client hostname javascriptJAVASCRIPT

Click to see more ...

  1.9K     249

detect ie javascriptdetect ie javascriptJAVASCRIPT

Click to see more ...

  1K     148

get ip address javascriptget ip address javascriptJAVASCRIPT

Click to see more ...

  604     74

create qr code javascriptcreate qr code javascriptJAVASCRIPT

Click to see more ...

  414     67

how to create foreach class using javascript ?how to create foreach class using javascript ?JAVASCRIPT

Click to see more ...

  352     64

get current url using javascriptget current url using javascriptJAVASCRIPT

Click to see more ...

  266     52

get filename using javascript get filename using javascript JAVASCRIPT

Click to see more ...

  248     45

how to create the connect to a database with ADODB using javascript ?how to create the connect to a database with ADODB using javascript ?JAVASCRIPT

Click to see more ...

  231     43

How replace reverse solidus using javascript ?How replace reverse solidus using javascript ?JAVASCRIPT

Click to see more ...

  222     41