$(function(){
var alltr=$("#test tr");
var sum=null;
var trsum=null;
for(var i=0;i<alltr.length;i++){
trsum=parseFloat($(alltr[i]).text());//此处不要小数可以(parseInt)
alert(trsum);
sum+=trsum;
}
alert(sum);
alert(Math.round(sum*100)/100);
/*
$("#total").text("总价格"+sum);
$("#total").text("总价格"+sum);
var num=22.127456;
alert( Math.round(num*100)/100); */
});
</script>
</head>
<body>
<!--登录弹窗-->
<table id="test">
<tr>
<td>1.5</td>
</tr>
<tr>
<td>2.2</td>
</tr>
<tr>
<td>3.2</td>
</tr>