Prova questo codice. Fa refresh ogni 5 secondi, ma iniziando a digitare nell'input, il refresh della pagina viene disabilitato e si ripristina 10 secondi dopo l'ultimo carattere digitato.codice:<script type="text/javascript"> <!-- var wait = 5000; var wakeon = 10000; var refreshpage = setTimeout('location.href="pagina.php"', wait); var wakeonrefresh = null; function suspendRefresh() { if (refreshpage != null) clearTimeout(refreshpage); if (wakeonrefresh != null) { clearTimeout(wakeonrefresh); } wakeonrefresh = setTimeout('location.href="pagina.php"', wakeon); } --> </script> ... <input type="text" onkeyup="suspendRefresh()" /> <input type="text" onkeyup="suspendRefresh()" />

Rispondi quotando