<span style="font-size:18px;"> var calculateScale = function(panel){
var $txtJhl = panel.find(":text[name='jhl']");
var $txtBl = panel.find(":text[name='bl']");
$txtBl.onlyPressNumber();
$txtJhl.onlyPressNumber();
$txtJhl.blur(function(){
var sum = 0;
$txtJhl.each(function(i,r){
if($(this).val() != null && $(this).val() != ""){
sum += parseFloat($(this).val());
}
});
var sumScale = 0;
$txtJhl.each(function(i,r){
if($(this).val() != null && $(this).val() != ""){
var scale = Math.round(parseFloat($(this).val())/sum*100);
if(i == $txtJhl.size()-1){
$txtBl.get(i).value = 100 - sumScale;
}else{
$txtBl.get(i).value = scale;
}
sumScale += scale;
}
});
});
};</span>