<form name="my_form" method="post" action="#">
<p>
Логин: <input type="text" name="login" onblur="checkLogin(this.value)" /><span id="check_login"></span>
</p>
<p>
<input type="submit" name="check" value="Отправить" />
</p>
</form>
(function () {
var sendObject = {};
document.addEventListener('input', function (e) {
if (e.target.name == 'login') {
clearTimeout(sendObject.timer);
sendObject = {
target: e.target,
timer: setTimeout(send, 500)
};
}
});
function send () {
console.log(sendObject.target.value);
}
})();
document.getElementById("id").onkeyup = function() {
// ...
};