<input id="otxt" type="text" />
<script>
function onSub(){
alert('验证');
}
var timer =null
document.getElementById('otxt').onkeyup =function(){
clearTimeout(timer);
timer = setTimeout(onSub, 2000);
}
</script>
<input id="otxt" type="text" />
<script>
function onSub(){
alert('验证');
}
var timer =null
document.getElementById('otxt').onkeyup =function(){
clearTimeout(timer);
timer = setTimeout(onSub, 2000);
}
</script>