<script type="text/javascript"> Number.prototype.toPercent = function(){ return (Math.round(this * 10000)/100).toFixed(2) + '%'; } var A=0.35897, B=0.25554; alert([A, A.toPercent(), B, B.toPercent()].join('\n')); </script>
转载于:https://www.cnblogs.com/wlwjc/archive/2012/07/12/2588088.html