1
I need a function run every 2 minutes.
I found in this link a solution to my need:
The Code below, calls an Alert after 5 seconds while leaving the mouse stationary.
Observing
I put 5 seconds to save time on the test.
<script type="text/javascript">
$(function() {
timeout = setTimeout(function() {
alert('executa função');
}, 5000);
});
$(document).on('mouseover', function() {
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(function() {
alert('executa função');
}, 5000);
});
</script>
What I need:
I need this script to work the same way only in an infinite loop, where every 5 seconds will be called the Alert.
I tried to embrace the code with:
while(0 = 0){
}
But it didn’t work...
How do I then have my function run infinitely every 5 seconds automatically?
this same...leave it like: counted 5s ->calls Function, counted +5s -> calls Function...
– Charles Fay