我的onPause事件(效率) [英] my onPause Event (efficiency)

查看:77
本文介绍了我的onPause事件(效率)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不完全是一个事件,但它具有相同的通用目的。基本上,当用户停止键入500毫秒时,它将触发事件。原因是,我有一个ajax表单,我希望表单自动验证(无需等待onchange事件触发)。我首先想知道这是一个很好的方法吗? (简单请!)其次我怎样才能改善这个(效率明智)或者它很好:


例如:

JS:

<跨度类= codeLink 的onclick =模糊(此,this.parentNode.parentNode,的getChildren(本),TRUE); >展开 | 选择 | Wrap | 行号

解决方案

为什么不只是onkeyup事件并完成它?


因为我不想每秒多次拨打ajax电话,我相信这会给低端机器带来不必要的压力(不是吗?)更何况当有人进入所有领域时在注册页面上它最终会结束lling check.php 20-50次,我猜测为5-10次。


所以,我认为这种方法可以节省客户端和服务器系统资源和带宽。


我查看了你的代码,发现你只启用了提交按钮。 Ajax调用了什么?即使用户停止输入半秒钟,如果他们输入另一个字符,Ajax调用现在也没用了。


Not exactly an event but it has the same general purpose. Basicly it will fire the event when the user stops typing for 500 miliseconds. The reason for this, is I have an ajax form and I want the form to validate automaticly (without having to wait for the onchange event to fire). I was wondering first of all if this is a good way to do it? (simplicity please!) and secondly how can I improve this (efficiency wise) or is it fine as is:

Example:
JS:

Expand|Select|Wrap|Line Numbers

解决方案

Why not just the onkeyup event and be done with it?


because I don''t want to call on an ajax call multiple times per second, I believe this would put unnecessary pressure on low-end machines (wouldn''t it?) not to mention when someone enters all the fields on a register page it would end up calling check.php 20-50 times i''m guessing as apposed to 5-10 times.

So yeh this method I would think would save both client and server system resources and bandwidth.


I was looking at your code and saw that you were enabling the submit button only. What Ajax calls are made? Even if the user stops typing for half a second, if they type another character, the Ajax call would now be useless.


这篇关于我的onPause事件(效率)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆