//合计按钮响应函数
function sum(){
var cost1 = document.getElementsByName("cost");
var total = 0;
for(var i=0; i < cost1.length;i++)
{
total = total + parseInt(cost1[i].value);
}
document.getElementById("total").value = total;
}