function checkMoney(t){
var val = $(t).val();
//先把非数字的都替换掉,除了数字和.
val = val.replace(/[^\d.]/g,"");
// alert(val);
//必须保证第一个为数字而不是.
val = val.replace(/^\./g,"");
// alert(val);
//保证只有出现一个.而没有多个.
val = val.replace(/\.{2,}/g,".");
val = val.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
$(t).val(val);
}
/**
* 格式化金额
* @param t
*/
function formatmoney(t){
// var reg = /\d+?\.\d{2}/;
var stringObject =$(t).val();
if(stringObject==''){
stringObject=0;
$(t).val(0);
}else{
//匹配32.11111,输出为32.11,32. 输出为32
var reg = /([1-9]\d{0,}\.\d{1,2})|(0\.\d{1,2})|([1-9]\d{0,})/;
// /(\d+?\.\d{1,2})|(\d+?)/;
var result = stringObject.match(reg);
if(null==result){
$(t).val(0);
}else{
$(t).val(result[0]);
} }
};