js控制文本域输入在一定间隔时间段触发事件查询相关数据

版权声明:本文为博主原创文章,未经博主允许不得转载。 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>

猜你喜欢

转载自blog.csdn.net/linli1991/article/details/89361568
今日推荐