/**
* 整数输入
*/
$.fn.createIntInput = function(cfg,handler){
this.keyup(function(){
if(this.value == ''){
return ;
}
var thiz = $(this);
var val = parseInt(this.value);
if(isNaN(val))
{
this.value = thiz.attr('oldval')||cfg.min;
return ;
}
this.value = val ;
if(cfg && cfg.min && val < cfg.min )
{
this.value = cfg.min ;
}
if(cfg && cfg.max && val > cfg.max)
{
this.value = cfg.max ;
}
thiz.attr('oldval',this.value);
if(handler)
{
handler.call(this,this.value);
}
});
var thiz = this ;
this.blur(function(){
if(this.value == '')
{
this.value = cfg.min||0;
}
thiz.keyup();
})
}