Dovrebbe funzionare decentemente
codice:
<html>
<body>
<p id="myphrase"></p>
</body>
<script type="text/javascript>
(function(id, phrase) {
var el = document.getElementById(id),
wait17, from17to19; // intervals
(function() {
var hours = (new Date()).getHours();
if (hours >= 17 && hours < 19) {
//console.log('dopo le 17 oppure prima delle 19: %d', hours);
if (wait17) clearInterval(wait17);
if (el.innerHTML == '') el.innerHTML = phrase;
from17to19 = setTimeout(arguments.callee, (1000 * 60))
}
else {
//console.log('prima delle 17 oppure dopo le 19: %d', hours);
if (from17to19) clearInterval(from17to19);
if (el.innerHTML != '') element.innerHTML = '';
wait17 = setTimeout(arguments.callee, (1000 * 60));
}
})();
})('myphrase', 'inserisci qui la tua frase'); // id placeholder, phrase
</script>
</html>
Ciao