<a onclick="clickIncrement()" href="javascript:void(0);">+</a>
<script type="text/Javascript">
var this_timer_id = null;function clickIncrement(){
if(typeof this_timer_id != null) { clearTimeout(this_timer_id); } this_timer_id = setTimeout(XXXX, 1000); //1000ms XXXX是Ajax提交方法
}</script>
备注:
这种方式也可以用户input文本输入,输入结束后提交1次ajax请求
<input type="text" id="usr_id" name="usr_id" class="txt" style="width:150px;" onkeyup="usrIdInputKeyUp(event)">
<script type="text/javascript">
var this_timer_id = null;function usrIdInputKeyUp(e){ switch(e.keyCode) { case 27: // ESC PRohibit the use of ESC return false; default: if(typeof this_timer_id != null) { clearTimeout(this_timer_id); } this_timer_id = setTimeout(xxxx, 1000); //1000ms break; } return false;}</script>
新闻热点
疑难解答