<script type="text/javascript">
window.onload = function() {
function foo() {
alert("Don't stop typing!");
t = setTimeout(arguments.callee, 2000);
}
var t = setTimeout(foo, 2000);
document.getElementById("my_input").onkeyup = function() {
if (t) clearTimeout(t);
t = setTimeout(foo, 2000);
}
}
</script>
<input type="text" id="my_input" />