//获取J29单元格值 var a=$('td[id^="J29-"]','div#REPORT0').html(); //计算新值 var b=Number(a.replace(/,/,""))+Number(10); //字体变色 $('td[id^="J29-"]','div#REPORT0').css('color','red'); //数字转换为千分位的函数 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); 点击之后里边的值就显示这样 |