js求两个整数的百分比

  function GetPercent(num, total) {
                          num = parseFloat(num);
                          total = parseFloat(total);
                          if (isNaN(num) || isNaN(total)) {
                              return "-";
                         }
                        return total <= 0 ? "0%" : (Math.round(num / total * 100) / 100.00);
                   } 

原文地址:https://www.cnblogs.com/chenlove/p/8822682.html