版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/linli1991/article/details/89361568
<input type="text" onkeydown="openFlag()" onkeyup="closeFlag()" />
<script>
var flag = 0;
var t;
function openFlag () {
clearTimeout(t);
flag = 0;
}
function closeFlag(callback, id, method, type) {
t = setTimeout(function(){flag = 1; callback(id, method, type);}, 1000);
}
</script>