<table border="1px">
<tr>
<td>1</td>
<td>2测试</td>
</tr>
<tr>
<td>3测试</td>
<td>4测试</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
</table>
替换后的代码:
$("table tr td").each(function(){
var $td = $(this)
var val = $td.text().replace(/(\d+)/g, "$1%")
$td.text(val)
})
function Percentage(number1, number2) {return (Math.round(num / total * 10000) / 100.00 + "%")// 小数点后两位百分比
}