//根据id获取控件的值,如果没有数据默认赋值为0 function getDataById(id) { var data = $("#"+id).val(); if(data==""){ data=0; } return data; }