这样试试
function TbValue(tbObj)
{
var tableObj = Report8View1_MyDataGrid;
var currentRow = tbObj.parentElement.parentElement.rowIndex;//当前行
var currentCol = tbObj.parentElement.cellIndex;//当前列
var a=0,b=0;
a = tableObj.rows[currentRow].cells[currentCol-2].firstChild.value;
b = tableObj.rows[currentRow].cells[currentCol-1].firstChild.value;
if (a!=0 && b!=0)
{
tableObj.rows[currentRow].cells[currentCol].firstChild.innerText=formatFloat(a/b*100,2)+"%";
}
}
function formatFloat(src, pos)
{
return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
}