var http = new XMLHttpRequest(); var x=20; var started=0; var timerID; function fonc() { if (started==1) { clearTimeout(timerID); } started=1; timerID = setTimeout("exec()",300); } function exec() { document.getElementById("ok").innerHTML = "loading correction..."; http.open("GET","/dhtml/check/?phrase="+document.forms[0].message.value); http.onreadystatechange = change; http.send(null); started=0; } function change() { if (http.readyState == 4) { response = http.responseText; document.getElementById("ok").innerHTML = response; } }