深巷(提问者)我这有个js,用的超链接,在别的报表上可以,我改了里边的单元格,不生效,麻烦给看一下吧
//获取J29单元格值
var a=$(\'td[id^=\"J29-\"]\',\'div#REPORT0\').html();
//计算新值
var b=Number(a.replace(/,/,\"\"))+Number(10);
//字体变色
$(\'td[id^=\"J29-\"]\',\'div#REPORT0\').css(\'color\',\'black\');
//数字转换为千分位的函数
function commafy(num){
if(/^.*\\..*$/.test(num)){
varpointIndex =num.lastIndexOf(\".\");
varintPart = num.substring(0,pointIndex);
varpointPart =num.substring(pointIndex+1,num.length);
intPart = intPart +\"\";
var re =/(-?\\d+)(\\d{3})/
while(re.test(intPart)){
intPart =intPart.replace(re,\"$1,$2\")
}
num = intPart+\".\"+pointPart;
}else{
num = num +\"\";
var re =/(-?\\d+)(\\d{3})/
while(re.test(num)){
num =num.replace(re,\"$1,$2\")
}
}
return num;
}
//数字转换为千分位
var c=commafy(b);
//改变单元格值
$(\'td[id^=\"J29-\"]\',\'div#REPORT0\').html(c);