var code = "";
window.onload = function(e){
var lastTime,nextTime;
var lastCode,nextCode;
document.onkeypress = function(e) {
nextCode = e.which;
nextTime = new Date().getTime();
if(lastCode != null && lastTime != null && nextTime - lastTime <= 50) {
code += String.fromCharCode(lastCode);
} else if(lastCode != null && lastTime != null && nextTime - lastTime > 100){
code = "";
}
lastCode = nextCode;
lastTime = nextTime;
}
this.onkeypress = function(e){
if(e.which == 13){
// alert(code)
code=code.replace(/\"/g, "");
code=code.replace(/\I/g, '');
code=code.replace(/\D/g, '');;
code=code.replace(/\}/g, "");
code=code.replace(/\{/g, "");
code=code.replace(/\:/g, "");
dataMng('{"ID":'+code+'}')
}
}
};